[#638] Update to Go 1.16

Changes:

  * replace `iotuil` elements with the ones from `os` package;
  * replace `os.Filemode` with `fs.FileMode`;
  * use `signal.NotifyContext` instead of `NewGracefulContext` (removed).

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-06-28 17:01:31 +03:00 committed by Leonard Lyubich
parent 61f48a2736
commit 56d4410913
30 changed files with 74 additions and 105 deletions

View file

@ -2,7 +2,7 @@ package airportsdb
import (
"fmt"
"os"
"io/fs"
"sync"
)
@ -41,7 +41,7 @@ type DB struct {
type pathMode struct {
path string
mode os.FileMode
mode fs.FileMode
}
const invalidPrmValFmt = "invalid parameter %s (%T):%v"

View file

@ -1,19 +1,19 @@
package airportsdb
import (
"os"
"io/fs"
)
// Option sets an optional parameter of DB.
type Option func(*options)
type options struct {
airportMode, countryMode os.FileMode
airportMode, countryMode fs.FileMode
}
func defaultOpts() *options {
return &options{
airportMode: os.ModePerm, // 0777
countryMode: os.ModePerm, // 0777
airportMode: fs.ModePerm, // 0777
countryMode: fs.ModePerm, // 0777
}
}

View file

@ -2,7 +2,7 @@ package locodebolt
import (
"fmt"
"os"
"io/fs"
"go.etcd.io/bbolt"
)
@ -34,7 +34,7 @@ type Prm struct {
type DB struct {
path string
mode os.FileMode
mode fs.FileMode
boltOpts *bbolt.Options

View file

@ -1,6 +1,7 @@
package locodebolt
import (
"io/fs"
"os"
"time"
@ -11,7 +12,7 @@ import (
type Option func(*options)
type options struct {
mode os.FileMode
mode fs.FileMode
boltOpts *bbolt.Options
}

View file

@ -2,7 +2,7 @@ package continentsdb
import (
"fmt"
"io/ioutil"
"os"
locodedb "github.com/nspcc-dev/neofs-node/pkg/util/locode/db"
"github.com/paulmach/orb"
@ -53,7 +53,7 @@ func (db *DB) PointContinent(point *locodedb.Point) (*locodedb.Continent, error)
}
func (db *DB) init() error {
data, err := ioutil.ReadFile(db.path)
data, err := os.ReadFile(db.path)
if err != nil {
return fmt.Errorf("could not read data file: %w", err)
}

View file

@ -1,14 +1,14 @@
package csvlocode
import (
"os"
"io/fs"
)
// Option sets an optional parameter of Table.
type Option func(*options)
type options struct {
mode os.FileMode
mode fs.FileMode
extraPaths []string
}

View file

@ -2,7 +2,7 @@ package csvlocode
import (
"fmt"
"os"
"io/fs"
"sync"
)
@ -32,7 +32,7 @@ type Prm struct {
type Table struct {
paths []string
mode os.FileMode
mode fs.FileMode
subDivPath string