Skip to content

Commit

Permalink
Chore/update deps (#699)
Browse files Browse the repository at this point in the history
* fixup linting

Signed-off-by: Frederic BIDON <[email protected]>

* updated deps

Signed-off-by: Frederic BIDON <[email protected]>
  • Loading branch information
fredbi authored Nov 29, 2022
1 parent 22972c2 commit 118f9fa
Show file tree
Hide file tree
Showing 25 changed files with 220 additions and 200 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,9 @@ linters:
- errname
- maintidx
- nosnakecase
- structcheck
- varcheck
- deadcode
- interfacebloat

max-same-issues: 0
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ require (
cloud.google.com/go v0.107.0 // indirect
cloud.google.com/go/storage v1.28.0
github.com/PuerkitoBio/goquery v1.8.0
github.com/aws/aws-sdk-go v1.44.145
github.com/aws/aws-sdk-go v1.44.147
github.com/blang/semver v3.5.1+incompatible
github.com/cenkalti/backoff/v4 v4.1.3
github.com/cenkalti/backoff/v4 v4.2.0
github.com/davecgh/go-spew v1.1.1
github.com/docker/go-units v0.5.0
github.com/go-chi/chi v4.1.2+incompatible
Expand All @@ -17,26 +17,26 @@ require (
github.com/gobuffalo/packr/v2 v2.8.3
github.com/google/go-querystring v1.1.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1
github.com/hashicorp/golang-lru v0.5.4
github.com/hashicorp/golang-lru v0.6.0
github.com/influxdata/influxdb v1.10.0
github.com/jacobsa/daemonize v0.0.0-20160101105449-e460293e890f
github.com/jacobsa/fuse v0.0.0-20220531202254-21122235c77a
github.com/karrick/godirwalk v1.17.0
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1
github.com/nightlyone/lockfile v1.0.0
github.com/opentracing/opentracing-go v1.2.0
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
github.com/rhysd/go-github-selfupdate v1.2.3
github.com/segmentio/ksuid v1.0.4
github.com/spf13/afero v1.9.3
github.com/spf13/cobra v1.6.1
github.com/spf13/viper v1.13.0
github.com/spf13/viper v1.14.0
github.com/stretchr/testify v1.8.1
github.com/ulikunitz/xz v0.5.10 // indirect
go.opencensus.io v0.24.0
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/goleak v1.2.0
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
golang.org/x/oauth2 v0.2.0 // indirect
Expand Down
65 changes: 35 additions & 30 deletions go.sum

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions pkg/cafs/cafs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ import (
"sync"
"time"

"github.com/docker/go-units"
lru "github.com/hashicorp/golang-lru"

"go.uber.org/zap"

"github.com/oneconcern/datamon/pkg/dlogger"
"github.com/oneconcern/datamon/pkg/metrics"
"github.com/oneconcern/datamon/pkg/storage"
"github.com/oneconcern/datamon/pkg/storage/localfs"

"github.com/docker/go-units"
"go.uber.org/zap"
)

const (
Expand Down
12 changes: 6 additions & 6 deletions pkg/cafs/freelists.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ type FreeList interface {
// It allocates a fixed array and exposes a slice backed by this array for consuming callers.
//
// Usage:
// * Bytes() buffer method to access the backing array as a slice
// * Copy() and Slice() buffer methods to modify the content of the buffer
// * Pin() to pin the buffer and prevent it from being recycled while in a critical section
// * Unpin() to mark a buffer recyclable
// - Bytes() buffer method to access the backing array as a slice
// - Copy() and Slice() buffer methods to modify the content of the buffer
// - Pin() to pin the buffer and prevent it from being recycled while in a critical section
// - Unpin() to mark a buffer recyclable
type LeafBuffer interface {
Bytes() []byte
Copy([]byte)
Expand Down Expand Up @@ -250,8 +250,8 @@ func sizeFunc(leafSize uint32) func() uint32 {
// The nil instance behaves as a regular new allocator, without buffer recycling.
//
// Usage:
// * Get() to get a bufer
// * Release() to mark a buffer for releasing to the free list.
// - Get() to get a bufer
// - Release() to mark a buffer for releasing to the free list.
//
// Releasing buffers to the list means that they can be re-used whenever idle.
//
Expand Down
10 changes: 5 additions & 5 deletions pkg/cafs/freelists_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,23 +176,23 @@ func testFreeBuffers(t *testing.T, leafSize, expectedSize uint32, expectedType i
var xsize uint32
switch expectedType.(type) {
case *leafBuffer1MB:
// nolint: staticcheck
//nolint: staticcheck
d := leafBuffer1MB{}
xsize = uint32(unsafe.Sizeof(d))
case *leafBuffer2MB:
// nolint: staticcheck
//nolint: staticcheck
d := leafBuffer2MB{}
xsize = uint32(unsafe.Sizeof(d))
case *leafBuffer3MB:
// nolint: staticcheck
//nolint: staticcheck
d := leafBuffer3MB{}
xsize = uint32(unsafe.Sizeof(d))
case *leafBuffer4MB:
// nolint: staticcheck
//nolint: staticcheck
d := leafBuffer4MB{}
xsize = uint32(unsafe.Sizeof(d))
case *leafBufferMax:
// nolint: staticcheck
//nolint: staticcheck
d := leafBufferMax{}
xsize = uint32(unsafe.Sizeof(d))
default:
Expand Down
4 changes: 1 addition & 3 deletions pkg/cafs/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ import (
"sync"
"sync/atomic"

"go.uber.org/zap"

lru "github.com/hashicorp/golang-lru"

"github.com/oneconcern/datamon/pkg/dlogger"
"github.com/oneconcern/datamon/pkg/metrics"
"github.com/oneconcern/datamon/pkg/storage"
"go.uber.org/zap"
)

const (
Expand Down
4 changes: 1 addition & 3 deletions pkg/cafs/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ import (

"github.com/davecgh/go-spew/spew"
lru "github.com/hashicorp/golang-lru"
"go.uber.org/zap"

"github.com/oneconcern/datamon/internal/rand"

"github.com/oneconcern/datamon/pkg/dlogger"
"github.com/oneconcern/datamon/pkg/storage"
"github.com/oneconcern/datamon/pkg/storage/localfs"
"github.com/spf13/afero"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
)

func keyFromFile(t testing.TB, pth string) Key {
Expand Down
4 changes: 2 additions & 2 deletions pkg/convert/unsafe.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const sizeOfUintPtr = unsafe.Sizeof(uintptr(0))
// UnsafeStringToBytes converts strings to []byte without memcopy
func UnsafeStringToBytes(s string) []byte {
ln := len(s)
// nolint: govet
//nolint: govet
return *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{
Len: ln,
Cap: ln,
Expand Down Expand Up @@ -44,6 +44,6 @@ func BytesToInt64(b []byte) int64 {

// UnsafeBytesToString converts []byte to string without a memcopy
func UnsafeBytesToString(b []byte) string {
// nolint: govet
//nolint: govet
return *(*string)(unsafe.Pointer(&reflect.StringHeader{Data: uintptr(unsafe.Pointer(&b[0])), Len: len(b)}))
}
14 changes: 7 additions & 7 deletions pkg/core/bundle_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ type bundlesEvent struct {
//
// Example usage:
//
// err := doSelectBundles(bundlesChan, func(bundleBatch model.BundleDescriptors) {
// bundles = append(bundles, bundleBatch...)
// })
// err := doSelectBundles(bundlesChan, func(bundleBatch model.BundleDescriptors) {
// bundles = append(bundles, bundleBatch...)
// })
func doSelectBundles(bundlesChan <-chan bundlesEvent, do func(model.BundleDescriptors)) error {
// consume batches of ordered bundle metadata
for bundleBatch := range bundlesChan {
Expand All @@ -65,10 +65,10 @@ type ApplyBundleFunc func(model.BundleDescriptor) error
//
// Example usage: printing bundle descriptors as they come
//
// err := core.ListBundlesApply(repo, store, func(bundle model.BundleDescriptor) error {
// fmt.Fprintf(os.Stderr, "%v\n", bundle)
// return nil
// })
// err := core.ListBundlesApply(repo, store, func(bundle model.BundleDescriptor) error {
// fmt.Fprintf(os.Stderr, "%v\n", bundle)
// return nil
// })
func ListBundlesApply(repo string, stores context2.Stores, apply ApplyBundleFunc, opts ...Option) error {
var (
err, applyErr error
Expand Down
14 changes: 7 additions & 7 deletions pkg/core/diamond_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ type diamondsEvent struct {
//
// Example usage:
//
// err := doSelectDiamonds(diamondsChan, func(diamondBatch model.DiamondDescriptors) {
// diamonds = append(diamonds, diamondBatch...)
// })
// err := doSelectDiamonds(diamondsChan, func(diamondBatch model.DiamondDescriptors) {
// diamonds = append(diamonds, diamondBatch...)
// })
func doSelectDiamonds(diamondsChan <-chan diamondsEvent, do func(model.DiamondDescriptors)) error {
// consume batches of ordered diamond metadata
for diamondBatch := range diamondsChan {
Expand All @@ -60,10 +60,10 @@ type ApplyDiamondFunc func(model.DiamondDescriptor) error
//
// Example usage: printing diamond descriptors as they come
//
// err := core.ListDiamondsApply(repo, store, func(diamond model.DiamondDescriptor) error {
// fmt.Fprintf(os.Stderr, "%v\n", diamond)
// return nil
// })
// err := core.ListDiamondsApply(repo, store, func(diamond model.DiamondDescriptor) error {
// fmt.Fprintf(os.Stderr, "%v\n", diamond)
// return nil
// })
func ListDiamondsApply(repo string, stores context2.Stores, apply ApplyDiamondFunc, opts ...Option) error {
var (
err, applyErr error
Expand Down
4 changes: 2 additions & 2 deletions pkg/core/diamond_ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ func DiamondExists(repo, diamondID string, stores context2.Stores) error {

// diamondReady returns an error if the diamond is not in one of the following states:
//
// * DiamondInitialized
// * DiamondRunning
// - DiamondInitialized
// - DiamondRunning
//
// Diamonds in the DiamondCommitting state are not ready unless the state is older than 30s (stale lock state).
func diamondReady(repo, diamondID string, stores context2.Stores) error {
Expand Down
6 changes: 3 additions & 3 deletions pkg/core/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ func distributeKeys(keys []string) func(chan<- string, <-chan struct{}, *sync.Wa
//
// To achieve this without stashing previously fetched keys, we rely on the following properties of the metadata keys.
//
// * (filtered) keys for the same diamond or split in different states are adjacent: the internal map remains sparsely
// populated under normal conditions
// * keys are sorted: ".../{diamond-id}/diamond-done.yaml" will be fetched _before_ ".../{diamond-id}/diamond-running.yaml"
// - (filtered) keys for the same diamond or split in different states are adjacent: the internal map remains sparsely
// populated under normal conditions
// - keys are sorted: ".../{diamond-id}/diamond-done.yaml" will be fetched _before_ ".../{diamond-id}/diamond-running.yaml"
func mergeKeys(inputChan <-chan keyBatchEvent, outputChan chan<- keyBatchEvent, settings Settings, wg *sync.WaitGroup) {
defer func() {
close(outputChan)
Expand Down
14 changes: 7 additions & 7 deletions pkg/core/split_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ type splitsEvent struct {
//
// Example usage:
//
// err := doSelectSplits(splitsChan, func(splitBatch model.SplitDescriptors) {
// splits = append(splits, splitBatch...)
// })
// err := doSelectSplits(splitsChan, func(splitBatch model.SplitDescriptors) {
// splits = append(splits, splitBatch...)
// })
func doSelectSplits(splitsChan <-chan splitsEvent, do func(model.SplitDescriptors)) error {
// consume batches of ordered split metadata
for splitBatch := range splitsChan {
Expand All @@ -61,10 +61,10 @@ type ApplySplitFunc func(model.SplitDescriptor) error
//
// Example usage: printing split descriptors as they come
//
// err := core.ListSplitsApply(repo, store, func(split model.SplitDescriptor) error {
// fmt.Fprintf(os.Stderr, "%v\n", split)
// return nil
// })
// err := core.ListSplitsApply(repo, store, func(split model.SplitDescriptor) error {
// fmt.Fprintf(os.Stderr, "%v\n", split)
// return nil
// })
func ListSplitsApply(repo, diamondID string, stores context2.Stores, apply ApplySplitFunc, opts ...Option) error {
var (
err, applyErr error
Expand Down
66 changes: 33 additions & 33 deletions pkg/metrics/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,39 +79,39 @@ func mergeTags(extras []map[string]string) []tag.Mutator {
//
// Sample usage:
//
// type myType struct{
// ...
// metrics.Enable
// m *myMetrics // m points to the globally registered metrics collector
// }
//
// ...
//
// // MyTypeUsage describes a tree of metrics to be recorded on myType
// type MyTypeUsage struct {
// Volumetry struct {
// Metadata FilesMetrics `group:"metadata" description:"some file metrics issued by myType"`
// TestCount *stats.Int64Measure `metric:"testCount" description:"number of tests" extraviews:"sum"`
// } `group:"volumetry" description:"volumetry measurements that pertain to myType"`
// }
//
// func (u *MyTypeUsage) Reads() {
// metrics.Inc(u.Volumetry.Metadata.Read)
// }
//
// func (u *MyTypeUsage) Tests(p int) {
// metrics.Int64(u.Volumetry.TestCount, intt64(p))
// }
//
// ...
//
// func NewMyType() *myType {
// ...
// t := &MyType{}
// t.m := t.EnsureMetrics("MyType", &myMetrics{})
// t.EnableMetrics(true)
// return t
// }
// type myType struct{
// ...
// metrics.Enable
// m *myMetrics // m points to the globally registered metrics collector
// }
//
// ...
//
// // MyTypeUsage describes a tree of metrics to be recorded on myType
// type MyTypeUsage struct {
// Volumetry struct {
// Metadata FilesMetrics `group:"metadata" description:"some file metrics issued by myType"`
// TestCount *stats.Int64Measure `metric:"testCount" description:"number of tests" extraviews:"sum"`
// } `group:"volumetry" description:"volumetry measurements that pertain to myType"`
// }
//
// func (u *MyTypeUsage) Reads() {
// metrics.Inc(u.Volumetry.Metadata.Read)
// }
//
// func (u *MyTypeUsage) Tests(p int) {
// metrics.Int64(u.Volumetry.TestCount, intt64(p))
// }
//
// ...
//
// func NewMyType() *myType {
// ...
// t := &MyType{}
// t.m := t.EnsureMetrics("MyType", &myMetrics{})
// t.EnableMetrics(true)
// return t
// }
type Enable struct {
metricsEnabled bool
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/metrics/exporters/influxdb/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ func defaultExporter() *Exporter {
// NewExporter creates a new Influxdb exporter.
//
// Use options to configure:
// * an influxdd.Store instance, configured with the desired settings
// * an error handler. If set to nil, a no-op handler is set by default
// * a map of custom tags for written records (may be nil)
// - an influxdd.Store instance, configured with the desired settings
// - an error handler. If set to nil, a no-op handler is set by default
// - a map of custom tags for written records (may be nil)
func NewExporter(opts ...Option) *Exporter {
e := defaultExporter()
for _, apply := range opts {
Expand Down
Loading

0 comments on commit 118f9fa

Please sign in to comment.