From 56d441091331396dd1591aa916c468a789e62aaf Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 28 Jun 2021 17:01:31 +0300 Subject: [PATCH] [#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 --- .github/workflows/go.yml | 2 +- Dockerfile.cli | 2 +- Dockerfile.ir | 2 +- Dockerfile.storage | 2 +- Dockerfile.storage-testnet | 2 +- cmd/neofs-cli/modules/container.go | 13 ++++--- cmd/neofs-cli/modules/object.go | 7 ++-- cmd/neofs-cli/modules/root.go | 3 +- cmd/neofs-cli/modules/util.go | 11 +++--- cmd/neofs-ir/main.go | 8 +++-- cmd/neofs-node/config/engine/config_test.go | 6 ++-- .../config/engine/shard/blobstor/config.go | 8 ++--- .../config/engine/shard/metabase/config.go | 8 ++--- cmd/neofs-node/config/node/config.go | 4 +-- cmd/neofs-node/main.go | 5 +-- go.mod | 2 +- go.sum | Bin 64238 -> 63985 bytes .../blobovnicza/blobovnicza.go | 5 +-- pkg/local_object_storage/blobstor/blobstor.go | 4 +-- .../blobstor/fstree/fstree.go | 12 +++---- pkg/local_object_storage/metabase/db.go | 3 +- pkg/local_object_storage/metabase/info.go | 4 +-- pkg/util/grace/grace.go | 32 ------------------ pkg/util/locode/db/airports/db.go | 4 +-- pkg/util/locode/db/airports/opts.go | 8 ++--- pkg/util/locode/db/boltdb/db.go | 4 +-- pkg/util/locode/db/boltdb/opts.go | 3 +- .../locode/db/continents/geojson/calls.go | 4 +-- pkg/util/locode/table/csv/opts.go | 4 +-- pkg/util/locode/table/csv/table.go | 4 +-- 30 files changed, 74 insertions(+), 102 deletions(-) delete mode 100644 pkg/util/grace/grace.go diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 762a49a31..90a913549 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - go: [ '1.14.x', '1.15.x', '1.16.x' ] + go: [ '1.16.x' ] steps: - name: Setup go uses: actions/setup-go@v2 diff --git a/Dockerfile.cli b/Dockerfile.cli index 3ba2fbed8..1b309cc9e 100644 --- a/Dockerfile.cli +++ b/Dockerfile.cli @@ -1,4 +1,4 @@ -FROM golang:1.14-alpine as basebuilder +FROM golang:1.16-alpine as basebuilder RUN apk add --update make bash FROM basebuilder as builder diff --git a/Dockerfile.ir b/Dockerfile.ir index b6978f107..aeba28db5 100644 --- a/Dockerfile.ir +++ b/Dockerfile.ir @@ -1,4 +1,4 @@ -FROM golang:1.14-alpine as basebuilder +FROM golang:1.16-alpine as basebuilder RUN apk add --update make bash FROM basebuilder as builder diff --git a/Dockerfile.storage b/Dockerfile.storage index cc3d7d75b..006839e28 100644 --- a/Dockerfile.storage +++ b/Dockerfile.storage @@ -1,4 +1,4 @@ -FROM golang:1.14-alpine as basebuilder +FROM golang:1.16-alpine as basebuilder RUN apk add --update make bash FROM basebuilder as builder diff --git a/Dockerfile.storage-testnet b/Dockerfile.storage-testnet index 4f570ccb1..9db54d53c 100644 --- a/Dockerfile.storage-testnet +++ b/Dockerfile.storage-testnet @@ -1,4 +1,4 @@ -FROM golang:1.14-alpine as basebuilder +FROM golang:1.16-alpine as basebuilder RUN apk add --update make bash FROM basebuilder as builder diff --git a/cmd/neofs-cli/modules/container.go b/cmd/neofs-cli/modules/container.go index 520910cba..55ddcd9c0 100644 --- a/cmd/neofs-cli/modules/container.go +++ b/cmd/neofs-cli/modules/container.go @@ -6,7 +6,6 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" "math" "os" "strconv" @@ -339,7 +338,7 @@ var getContainerInfoCmd = &cobra.Command{ ) if containerPathFrom != "" { - data, err := ioutil.ReadFile(containerPathFrom) + data, err := os.ReadFile(containerPathFrom) if err != nil { cmd.PrintErrln(fmt.Errorf("can't read file: %w", err)) return @@ -398,7 +397,7 @@ var getContainerInfoCmd = &cobra.Command{ } } - err = ioutil.WriteFile(containerPathTo, data, 0644) + err = os.WriteFile(containerPathTo, data, 0644) if err != nil { cmd.PrintErrln(fmt.Errorf("can't write container to file: %w", err)) return @@ -472,7 +471,7 @@ var getExtendedACLCmd = &cobra.Command{ cmd.Println("Signature:") printJSONMarshaler(cmd, sig, "signature") - if err = ioutil.WriteFile(containerPathTo, data, 0644); err != nil { + if err = os.WriteFile(containerPathTo, data, 0644); err != nil { cmd.PrintErrln(err) } }, @@ -636,7 +635,7 @@ func getSessionToken(path string) (*session.Token, error) { var tok *session.Token if path != "" { - data, err := ioutil.ReadFile(path) + data, err := os.ReadFile(path) if err != nil { return nil, err } @@ -661,7 +660,7 @@ func parseContainerPolicy(policyString string) (*netmap.PlacementPolicy, error) if err == nil { printVerbose("Reading placement policy from file: %s", policyString) - data, err := ioutil.ReadFile(policyString) + data, err := os.ReadFile(policyString) if err != nil { return nil, fmt.Errorf("can't read file with placement policy: %w", err) } @@ -839,7 +838,7 @@ func parseEACL(eaclPath string) (*eacl.Table, error) { printVerbose("Reading EACL from file: %s", eaclPath) - data, err := ioutil.ReadFile(eaclPath) + data, err := os.ReadFile(eaclPath) if err != nil { return nil, fmt.Errorf("can't read file with EACL: %w", err) } diff --git a/cmd/neofs-cli/modules/object.go b/cmd/neofs-cli/modules/object.go index 34f943c6d..d020f5ed6 100644 --- a/cmd/neofs-cli/modules/object.go +++ b/cmd/neofs-cli/modules/object.go @@ -7,7 +7,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "math" "os" "path/filepath" @@ -638,7 +637,7 @@ func parseSearchFilters(cmd *cobra.Command) (object.SearchFilters, error) { default: return nil, fmt.Errorf("invalid field number: %d", len(words)) case 1: - data, err := ioutil.ReadFile(words[0]) + data, err := os.ReadFile(words[0]) if err != nil { return nil, err } @@ -808,7 +807,7 @@ func saveAndPrintHeader(cmd *cobra.Command, obj *object.Object, filename string) cmd.Println(string(bs)) return nil } - err := ioutil.WriteFile(filename, bs, os.ModePerm) + err := os.WriteFile(filename, bs, os.ModePerm) if err != nil { return err } @@ -906,7 +905,7 @@ func getBearerToken(cmd *cobra.Command, flagname string) (*token.BearerToken, er return nil, nil } - data, err := ioutil.ReadFile(path) + data, err := os.ReadFile(path) if err != nil { return nil, fmt.Errorf("can't read bearer token file: %w", err) } diff --git a/cmd/neofs-cli/modules/root.go b/cmd/neofs-cli/modules/root.go index 486721827..6ae57f06c 100644 --- a/cmd/neofs-cli/modules/root.go +++ b/cmd/neofs-cli/modules/root.go @@ -5,7 +5,6 @@ import ( "crypto/tls" "errors" "fmt" - "io/ioutil" "os" "path/filepath" "strings" @@ -195,7 +194,7 @@ func getKey() (*ecdsa.PrivateKey, error) { } func getKeyFromFile(keyPath string) (*ecdsa.PrivateKey, error) { - data, err := ioutil.ReadFile(keyPath) + data, err := os.ReadFile(keyPath) if err != nil { return nil, fmt.Errorf("%w: %v", errInvalidKey, err) } diff --git a/cmd/neofs-cli/modules/util.go b/cmd/neofs-cli/modules/util.go index 878161493..64aa148d7 100644 --- a/cmd/neofs-cli/modules/util.go +++ b/cmd/neofs-cli/modules/util.go @@ -6,7 +6,6 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" "os" "strconv" "time" @@ -303,7 +302,7 @@ func signBearerToken(cmd *cobra.Command, _ []string) { return } - err = ioutil.WriteFile(to, data, 0644) + err = os.WriteFile(to, data, 0644) if err != nil { cmd.PrintErrln(fmt.Errorf("can't write signed bearer token to file: %w", err)) return @@ -349,7 +348,7 @@ func signSessionToken(cmd *cobra.Command, _ []string) { return } - err = ioutil.WriteFile(to, data, 0644) + err = os.WriteFile(to, data, 0644) if err != nil { cmd.PrintErrln(fmt.Errorf("can't write signed session token to %s: %w", to, err)) return @@ -389,7 +388,7 @@ func convertEACLTable(cmd *cobra.Command, _ []string) { return } - err = ioutil.WriteFile(to, data, 0644) + err = os.WriteFile(to, data, 0644) if err != nil { cmd.PrintErrln(fmt.Errorf("can't write exteded ACL table to file: %w", err)) return @@ -486,7 +485,7 @@ func keyerGenerate(filename string, d *keyer.Dashboard) error { } if filename != "" { - return ioutil.WriteFile(filename, key, 0600) + return os.WriteFile(filename, key, 0600) } return nil @@ -502,7 +501,7 @@ func fileExists(filename string) bool { } func keyerParseFile(filename string, d *keyer.Dashboard) error { - data, err := ioutil.ReadFile(filename) + data, err := os.ReadFile(filename) if err != nil { return fmt.Errorf("can't open %v file: %w", filename, err) } diff --git a/cmd/neofs-ir/main.go b/cmd/neofs-ir/main.go index bfbb4ccfb..aad989199 100644 --- a/cmd/neofs-ir/main.go +++ b/cmd/neofs-ir/main.go @@ -1,16 +1,18 @@ package main import ( + "context" "flag" "fmt" "net/http" "os" + "os/signal" "strings" + "syscall" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neofs-node/misc" "github.com/nspcc-dev/neofs-node/pkg/innerring" - "github.com/nspcc-dev/neofs-node/pkg/util/grace" httputil "github.com/nspcc-dev/neofs-node/pkg/util/http" "github.com/nspcc-dev/neofs-node/pkg/util/logger" "github.com/prometheus/client_golang/prometheus/promhttp" @@ -58,7 +60,9 @@ func main() { log, err := logger.NewLogger(logPrm) exitErr(err) - ctx := grace.NewGracefulContext(log) + ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP) + defer cancel() + intErr := make(chan error) // internal inner ring errors httpServers := initHTTPServers(cfg) diff --git a/cmd/neofs-node/config/engine/config_test.go b/cmd/neofs-node/config/engine/config_test.go index 98ce0ea1d..d540b9a70 100644 --- a/cmd/neofs-node/config/engine/config_test.go +++ b/cmd/neofs-node/config/engine/config_test.go @@ -1,7 +1,7 @@ package engineconfig_test import ( - "os" + "io/fs" "testing" "time" @@ -47,7 +47,7 @@ func TestEngineSection(t *testing.T) { require.EqualValues(t, 555, wc.WorkersNumber()) require.Equal(t, "tmp/0/meta", meta.Path()) - require.Equal(t, os.FileMode(0700), meta.Perm()) + require.Equal(t, fs.FileMode(0700), meta.Perm()) require.Equal(t, "tmp/0/blob", blob.Path()) require.EqualValues(t, 0666, blob.Perm()) @@ -73,7 +73,7 @@ func TestEngineSection(t *testing.T) { require.EqualValues(t, 556, wc.WorkersNumber()) require.Equal(t, "tmp/1/meta", meta.Path()) - require.Equal(t, os.FileMode(0701), meta.Perm()) + require.Equal(t, fs.FileMode(0701), meta.Perm()) require.Equal(t, "tmp/1/blob", blob.Path()) require.EqualValues(t, 0667, blob.Perm()) diff --git a/cmd/neofs-node/config/engine/shard/blobstor/config.go b/cmd/neofs-node/config/engine/shard/blobstor/config.go index 419404637..791dfb193 100644 --- a/cmd/neofs-node/config/engine/shard/blobstor/config.go +++ b/cmd/neofs-node/config/engine/shard/blobstor/config.go @@ -1,7 +1,7 @@ package blobstorconfig import ( - "os" + "io/fs" "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" blobovniczaconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/engine/shard/blobstor/blobovnicza" @@ -45,10 +45,10 @@ func (x *Config) Path() string { return p } -// Perm returns value of "perm" config parameter as a os.FileMode. +// Perm returns value of "perm" config parameter as a fs.FileMode. // // Returns PermDefault if value is not a non-zero number. -func (x *Config) Perm() os.FileMode { +func (x *Config) Perm() fs.FileMode { p := config.UintSafe( (*config.Config)(x), "perm", @@ -58,7 +58,7 @@ func (x *Config) Perm() os.FileMode { p = PermDefault } - return os.FileMode(p) + return fs.FileMode(p) } // ShallowDepth returns value of "shallow_depth" config parameter. diff --git a/cmd/neofs-node/config/engine/shard/metabase/config.go b/cmd/neofs-node/config/engine/shard/metabase/config.go index a5df71e6c..0a0466ef2 100644 --- a/cmd/neofs-node/config/engine/shard/metabase/config.go +++ b/cmd/neofs-node/config/engine/shard/metabase/config.go @@ -1,7 +1,7 @@ package metabaseconfig import ( - "os" + "io/fs" "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" ) @@ -37,10 +37,10 @@ func (x *Config) Path() string { return p } -// Perm returns value of "perm" config parameter as a os.FileMode. +// Perm returns value of "perm" config parameter as a fs.FileMode. // // Returns PermDefault if value is not a positive number. -func (x *Config) Perm() os.FileMode { +func (x *Config) Perm() fs.FileMode { p := config.UintSafe( (*config.Config)(x), "perm", @@ -50,5 +50,5 @@ func (x *Config) Perm() os.FileMode { p = PermDefault } - return os.FileMode(p) + return fs.FileMode(p) } diff --git a/cmd/neofs-node/config/node/config.go b/cmd/neofs-node/config/node/config.go index c22fb239a..2aad548b5 100644 --- a/cmd/neofs-node/config/node/config.go +++ b/cmd/neofs-node/config/node/config.go @@ -3,7 +3,7 @@ package nodeconfig import ( "errors" "fmt" - "io/ioutil" + "os" "strconv" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" @@ -35,7 +35,7 @@ func Key(c *config.Config) *keys.PrivateKey { err error data []byte ) - if data, err = ioutil.ReadFile(v); err == nil { + if data, err = os.ReadFile(v); err == nil { key, err = keys.NewPrivateKeyFromBytes(data) } diff --git a/cmd/neofs-node/main.go b/cmd/neofs-node/main.go index 70f891f22..d311857f9 100644 --- a/cmd/neofs-node/main.go +++ b/cmd/neofs-node/main.go @@ -5,10 +5,11 @@ import ( "flag" "fmt" "log" + "os/signal" + "syscall" "github.com/nspcc-dev/neofs-node/misc" "github.com/nspcc-dev/neofs-node/pkg/services/control" - "github.com/nspcc-dev/neofs-node/pkg/util/grace" "go.uber.org/zap" ) @@ -48,7 +49,7 @@ func main() { } func initApp(c *cfg) { - c.ctx, c.ctxCancel = context.WithCancel(grace.NewGracefulContext(nil)) + c.ctx, c.ctxCancel = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP) initGRPC(c) diff --git a/go.mod b/go.mod index ecc70dbd4..c8e8e887e 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/nspcc-dev/neofs-node -go 1.14 +go 1.16 require ( github.com/golang/protobuf v1.5.2 diff --git a/go.sum b/go.sum index 24cc0acb3f3fea6570efd6bd37c984cce8e8f6e9..5887cf045df84a8c93b3049493a699c975cb981e 100644 GIT binary patch delta 24 gcmaF&mHFdm<_(X-HtUB^)Y#11FvD*%=lQ4F0H^E>Y5)KL delta 176 zcmezPnfcvU<_(X-^c6A;t$g&I%l!1(2$VeC11RlW4)!ur{MV2ybd&Sn+`r73=q+1{aMS>YM!MTIFvsikh2{(<3HhHk~? XA;w`v9wq@<<&zoD%5DC7_K!9IG9o}v diff --git a/pkg/local_object_storage/blobovnicza/blobovnicza.go b/pkg/local_object_storage/blobovnicza/blobovnicza.go index d316f3d79..fc7795d35 100644 --- a/pkg/local_object_storage/blobovnicza/blobovnicza.go +++ b/pkg/local_object_storage/blobovnicza/blobovnicza.go @@ -1,6 +1,7 @@ package blobovnicza import ( + "io/fs" "os" "time" @@ -33,7 +34,7 @@ type cfg struct { } type boltDBCfg struct { - perm os.FileMode + perm fs.FileMode path string @@ -77,7 +78,7 @@ func WithPath(path string) Option { // WithPermissions returns option to specify permission bits // of Blobovnicza's system path. -func WithPermissions(perm os.FileMode) Option { +func WithPermissions(perm fs.FileMode) Option { return func(c *cfg) { c.perm = perm } diff --git a/pkg/local_object_storage/blobstor/blobstor.go b/pkg/local_object_storage/blobstor/blobstor.go index aa3fdddcf..30ee25d65 100644 --- a/pkg/local_object_storage/blobstor/blobstor.go +++ b/pkg/local_object_storage/blobstor/blobstor.go @@ -2,7 +2,7 @@ package blobstor import ( "encoding/hex" - "os" + "io/fs" "path" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza" @@ -145,7 +145,7 @@ func WithRootPath(rootDir string) Option { // WithRootPerm returns option to set permission // bits of the fs tree. -func WithRootPerm(perm os.FileMode) Option { +func WithRootPerm(perm fs.FileMode) Option { return func(c *cfg) { c.fsTree.Permissions = perm c.blzOpts = append(c.blzOpts, blobovnicza.WithPermissions(perm)) diff --git a/pkg/local_object_storage/blobstor/fstree/fstree.go b/pkg/local_object_storage/blobstor/fstree/fstree.go index 840e9d08e..d22fd73cc 100644 --- a/pkg/local_object_storage/blobstor/fstree/fstree.go +++ b/pkg/local_object_storage/blobstor/fstree/fstree.go @@ -3,7 +3,7 @@ package fstree import ( "crypto/sha256" "errors" - "io/ioutil" + "io/fs" "os" "path" "strings" @@ -23,7 +23,7 @@ type FSTree struct { // Info groups the information about file storage. type Info struct { // Permission bits of the root directory. - Permissions os.FileMode + Permissions fs.FileMode // Full path to the root directory. RootPath string @@ -73,7 +73,7 @@ func (t *FSTree) Iterate(f func(addr *objectSDK.Address, data []byte) error) err func (t *FSTree) iterate(depth int, curPath []string, f func(*objectSDK.Address, []byte) error) error { curName := strings.Join(curPath[1:], "") - des, err := ioutil.ReadDir(path.Join(curPath...)) + des, err := os.ReadDir(path.Join(curPath...)) if err != nil { return err } @@ -101,7 +101,7 @@ func (t *FSTree) iterate(depth int, curPath []string, f func(*objectSDK.Address, continue } - data, err := ioutil.ReadFile(path.Join(curPath...)) + data, err := os.ReadFile(path.Join(curPath...)) if err != nil { return err } @@ -161,7 +161,7 @@ func (t *FSTree) Put(addr *objectSDK.Address, data []byte) error { return err } - return ioutil.WriteFile(p, data, t.Permissions) + return os.WriteFile(p, data, t.Permissions) } // Get returns object from storage by address. @@ -172,5 +172,5 @@ func (t *FSTree) Get(addr *objectSDK.Address) ([]byte, error) { return nil, ErrFileNotFound } - return ioutil.ReadFile(p) + return os.ReadFile(p) } diff --git a/pkg/local_object_storage/metabase/db.go b/pkg/local_object_storage/metabase/db.go index 0b219fc59..bee091a6b 100644 --- a/pkg/local_object_storage/metabase/db.go +++ b/pkg/local_object_storage/metabase/db.go @@ -3,6 +3,7 @@ package meta import ( "encoding/binary" "encoding/hex" + "io/fs" "os" "strconv" @@ -132,7 +133,7 @@ func WithPath(path string) Option { // WithPermissions returns option to specify permission bits // of Metabase system path. -func WithPermissions(perm os.FileMode) Option { +func WithPermissions(perm fs.FileMode) Option { return func(c *cfg) { c.info.Permission = perm } diff --git a/pkg/local_object_storage/metabase/info.go b/pkg/local_object_storage/metabase/info.go index 967e9c713..7d1bfefb7 100644 --- a/pkg/local_object_storage/metabase/info.go +++ b/pkg/local_object_storage/metabase/info.go @@ -1,7 +1,7 @@ package meta import ( - "os" + "io/fs" ) // Info groups the information about DB. @@ -10,7 +10,7 @@ type Info struct { Path string // Permission of database file. - Permission os.FileMode + Permission fs.FileMode } // DumpInfo returns information about the DB. diff --git a/pkg/util/grace/grace.go b/pkg/util/grace/grace.go deleted file mode 100644 index 100e124d0..000000000 --- a/pkg/util/grace/grace.go +++ /dev/null @@ -1,32 +0,0 @@ -package grace - -import ( - "context" - "fmt" - "os" - "os/signal" - "syscall" - - "go.uber.org/zap" -) - -// NewGracefulContext returns grace context that cancelled by sigint, -// sigterm and sighup. -func NewGracefulContext(l *zap.Logger) context.Context { - ctx, cancel := context.WithCancel(context.Background()) - - go func() { - ch := make(chan os.Signal, 1) - signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP) - sig := <-ch - if l != nil { - l.Info("received signal", - zap.String("signal", sig.String())) - } else { - fmt.Printf("received signal %s\n", sig) - } - cancel() - }() - - return ctx -} diff --git a/pkg/util/locode/db/airports/db.go b/pkg/util/locode/db/airports/db.go index d63aaa518..f14414cc1 100644 --- a/pkg/util/locode/db/airports/db.go +++ b/pkg/util/locode/db/airports/db.go @@ -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" diff --git a/pkg/util/locode/db/airports/opts.go b/pkg/util/locode/db/airports/opts.go index 1f5a3ea6a..3799d9e27 100644 --- a/pkg/util/locode/db/airports/opts.go +++ b/pkg/util/locode/db/airports/opts.go @@ -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 } } diff --git a/pkg/util/locode/db/boltdb/db.go b/pkg/util/locode/db/boltdb/db.go index 53a23b22d..56655841a 100644 --- a/pkg/util/locode/db/boltdb/db.go +++ b/pkg/util/locode/db/boltdb/db.go @@ -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 diff --git a/pkg/util/locode/db/boltdb/opts.go b/pkg/util/locode/db/boltdb/opts.go index 62b132596..db0cccd3a 100644 --- a/pkg/util/locode/db/boltdb/opts.go +++ b/pkg/util/locode/db/boltdb/opts.go @@ -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 } diff --git a/pkg/util/locode/db/continents/geojson/calls.go b/pkg/util/locode/db/continents/geojson/calls.go index 288fded6f..06842e336 100644 --- a/pkg/util/locode/db/continents/geojson/calls.go +++ b/pkg/util/locode/db/continents/geojson/calls.go @@ -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) } diff --git a/pkg/util/locode/table/csv/opts.go b/pkg/util/locode/table/csv/opts.go index b638d25d5..e521ddf7f 100644 --- a/pkg/util/locode/table/csv/opts.go +++ b/pkg/util/locode/table/csv/opts.go @@ -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 } diff --git a/pkg/util/locode/table/csv/table.go b/pkg/util/locode/table/csv/table.go index e9bc3e207..ef5e996dc 100644 --- a/pkg/util/locode/table/csv/table.go +++ b/pkg/util/locode/table/csv/table.go @@ -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