diff --git a/bigquery/client.go b/bigquery/client.go index 30a1803..b479533 100644 --- a/bigquery/client.go +++ b/bigquery/client.go @@ -17,8 +17,22 @@ type Client struct { client *bigquery.Client } +func NewClient(projectID string) *Client { + ctx := context.Background() + gOpt := option.WithGRPCDialOption(grpc.WithKeepaliveParams(keepalive.ClientParameters{ + Time: 1 * time.Second, + Timeout: 5 * time.Second, + PermitWithoutStream: true, + })) + client, err := bigquery.NewClient(ctx, projectID, gOpt) + if err != nil { + panic(err) + } + return &Client{client} +} + // クエリを実行し、データを取得する -func (c *Client) List(ctx context.Context, query string, limit int, cursor string, dsts interface{}) (string, error) { +func (c *Client) List(ctx context.Context, query string, limit int, cursor string, dsts any) (string, error) { q := c.client.Query(query) it, err := q.Read(ctx) if err != nil { @@ -56,20 +70,3 @@ func (c *Client) List(ctx context.Context, query string, limit int, cursor strin } return token, nil } - -// クライアントを作成する -func NewClient(projectID string) *Client { - ctx := context.Background() - gOpt := option.WithGRPCDialOption(grpc.WithKeepaliveParams(keepalive.ClientParameters{ - Time: 1 * time.Second, - Timeout: 5 * time.Second, - PermitWithoutStream: true, - })) - client, err := bigquery.NewClient(ctx, projectID, gOpt) - if err != nil { - panic(err) - } - return &Client{ - client: client, - } -} diff --git a/cloudfirestore/helper.go b/cloudfirestore/helper.go index 0fa83e0..cb44398 100644 --- a/cloudfirestore/helper.go +++ b/cloudfirestore/helper.go @@ -87,7 +87,7 @@ func CommitBulkWriter(ctx context.Context) (context.Context, error) { } // 単体取得する(tx対応) -func Get(ctx context.Context, docRef *firestore.DocumentRef, dst interface{}) (bool, error) { +func Get(ctx context.Context, docRef *firestore.DocumentRef, dst any) (bool, error) { if docRef == nil || docRef.ID == "" || !ValidateDocumentID(docRef.ID) { return false, nil } @@ -116,7 +116,7 @@ func Get(ctx context.Context, docRef *firestore.DocumentRef, dst interface{}) (b } // 複数取得する(tx対応) -func GetMulti(ctx context.Context, cFirestore *firestore.Client, docRefs []*firestore.DocumentRef, dsts interface{}) error { +func GetMulti(ctx context.Context, cFirestore *firestore.Client, docRefs []*firestore.DocumentRef, dsts any) error { docRefs = sliceutil.StreamOf(docRefs). Filter(func(docRef *firestore.DocumentRef) bool { return docRef != nil && docRef.ID != "" && ValidateDocumentID(docRef.ID) @@ -157,7 +157,7 @@ func GetMulti(ctx context.Context, cFirestore *firestore.Client, docRefs []*fire } // クエリで単体取得する(tx対応) -func GetByQuery(ctx context.Context, query firestore.Query, dst interface{}) (bool, error) { +func GetByQuery(ctx context.Context, query firestore.Query, dst any) (bool, error) { query = query.Limit(1) var it *firestore.DocumentIterator if tx := getContextTransaction(ctx); tx != nil { @@ -185,7 +185,7 @@ func GetByQuery(ctx context.Context, query firestore.Query, dst interface{}) (bo } // クエリで複数取得する(tx対応) -func ListByQuery(ctx context.Context, query firestore.Query, dsts interface{}) error { +func ListByQuery(ctx context.Context, query firestore.Query, dsts any) error { var it *firestore.DocumentIterator if tx := getContextTransaction(ctx); tx != nil { it = tx.Documents(query) @@ -219,7 +219,7 @@ func ListByQuery(ctx context.Context, query firestore.Query, dsts interface{}) e } // クエリで複数取得する(ページング) -func ListByQueryCursor(ctx context.Context, query firestore.Query, limit int, cursor *firestore.DocumentSnapshot, dsts interface{}) (*firestore.DocumentSnapshot, error) { +func ListByQueryCursor(ctx context.Context, query firestore.Query, limit int, cursor *firestore.DocumentSnapshot, dsts any) (*firestore.DocumentSnapshot, error) { if cursor != nil { query = query.StartAfter(cursor) } @@ -262,7 +262,7 @@ func ListByQueryCursor(ctx context.Context, query firestore.Query, limit int, cu } // 作成する(tx, bw対応) -func Create(ctx context.Context, colRef *firestore.CollectionRef, src interface{}) error { +func Create(ctx context.Context, colRef *firestore.CollectionRef, src any) error { // 不正なIDがないかチェック if !ValidateCollectionRef(colRef) { return errors.New("Invalid Collection Path: " + colRef.Path) @@ -298,7 +298,7 @@ func Create(ctx context.Context, colRef *firestore.CollectionRef, src interface{ } // 更新する(tx, bw対応) -func Update(ctx context.Context, docRef *firestore.DocumentRef, kv map[string]interface{}) error { +func Update(ctx context.Context, docRef *firestore.DocumentRef, kv map[string]any) error { srcs := []firestore.Update{} for k, v := range kv { src := firestore.Update{Path: k, Value: v} @@ -327,7 +327,7 @@ func Update(ctx context.Context, docRef *firestore.DocumentRef, kv map[string]in } // 上書きする(tx, bw対応) -func Set(ctx context.Context, docRef *firestore.DocumentRef, src interface{}) error { +func Set(ctx context.Context, docRef *firestore.DocumentRef, src any) error { // 不正なIDがないかチェック if !ValidateDocumentRef(docRef) { return errors.New("Invalid Document Path: " + docRef.Path) diff --git a/cloudfirestore/util.go b/cloudfirestore/util.go index 87192f5..318bd7e 100644 --- a/cloudfirestore/util.go +++ b/cloudfirestore/util.go @@ -6,7 +6,7 @@ import ( "cloud.google.com/go/firestore" ) -func setDocByDst(dst interface{}, ref *firestore.DocumentRef) { +func setDocByDst(dst any, ref *firestore.DocumentRef) { rv := reflect.Indirect(reflect.ValueOf(dst)) rt := rv.Type() if rt.Kind() == reflect.Struct { @@ -42,7 +42,7 @@ func setDocByDsts(rv reflect.Value, rt reflect.Type, ref *firestore.DocumentRef) } } -func setEmptyBySlice(dst interface{}) { +func setEmptyBySlice(dst any) { rv := reflect.Indirect(reflect.ValueOf(dst)) rt := rv.Type() if rt.Kind() == reflect.Struct { diff --git a/cloudpubsub/client.go b/cloudpubsub/client.go index 0bb035f..82ce0a8 100644 --- a/cloudpubsub/client.go +++ b/cloudpubsub/client.go @@ -45,7 +45,7 @@ func NewClient(projectID string) *Client { func (c *Client) Publish( ctx context.Context, topicID string, - msg interface{}, + msg any, ) error { bMsg, err := json.Marshal(msg) if err != nil { diff --git a/cloudtasks/client.go b/cloudtasks/client.go index 51b7acb..c66c0a7 100644 --- a/cloudtasks/client.go +++ b/cloudtasks/client.go @@ -56,7 +56,7 @@ func NewClient( } // リクエストをEnqueueする -func (c *Client) AddTask(ctx context.Context, queue string, path string, params interface{}) error { +func (c *Client) AddTask(ctx context.Context, queue string, path string, params any) error { headers := map[string]string{ "Content-Type": "application/json", "Authorization": c.authToken, diff --git a/csv/client.go b/csv/client.go index 1569bed..ec6f128 100644 --- a/csv/client.go +++ b/csv/client.go @@ -14,7 +14,7 @@ import ( ) // レスポンス形式に変換する -func ToResponse(ctx context.Context, srcs interface{}) ([][]string, error) { +func ToResponse(ctx context.Context, srcs any) ([][]string, error) { bytes, err := csvutil.Marshal(srcs) if err != nil { log.Error(ctx, err) @@ -32,7 +32,7 @@ func ToResponse(ctx context.Context, srcs interface{}) ([][]string, error) { } // URLからCSVデータを取得する -func GetByURL(ctx context.Context, url string, dsts interface{}) error { +func GetByURL(ctx context.Context, url string, dsts any) error { status, body, err := httpclient.Get(ctx, url, nil) if err != nil { log.Error(ctx, err) @@ -51,7 +51,7 @@ func GetByURL(ctx context.Context, url string, dsts interface{}) error { } // 文字列からCSVデータを取得する -func GetByStr(ctx context.Context, str string, dsts interface{}) error { +func GetByStr(ctx context.Context, str string, dsts any) error { bytes := stringutil.ToBytes(str) err := GetByBytes(ctx, bytes, dsts) if err != nil { @@ -62,7 +62,7 @@ func GetByStr(ctx context.Context, str string, dsts interface{}) error { } // バイト列からCSVデータを取得する -func GetByBytes(ctx context.Context, bytes []byte, dsts interface{}) error { +func GetByBytes(ctx context.Context, bytes []byte, dsts any) error { err := csvutil.Unmarshal(bytes, dsts) if err != nil { log.Error(ctx, err) diff --git a/firebaseauth/context.go b/firebaseauth/context.go index 5dcf0ca..9f9b982 100644 --- a/firebaseauth/context.go +++ b/firebaseauth/context.go @@ -27,9 +27,9 @@ func GetUserID(ctx context.Context) string { } // FirebaseAuthのJWTClaimsの値を取得 -func GetClaims(ctx context.Context) (map[string]interface{}, bool) { +func GetClaims(ctx context.Context) (map[string]any, bool) { if dst := ctx.Value(claimsContextKey); dst != nil { - return dst.(map[string]interface{}), true + return dst.(map[string]any), true } return nil, false } @@ -42,6 +42,6 @@ func setUserID(ctx context.Context, userID string) context.Context { return context.WithValue(ctx, userIDContextKey, userID) } -func setClaims(ctx context.Context, claims map[string]interface{}) context.Context { +func setClaims(ctx context.Context, claims map[string]any) context.Context { return context.WithValue(ctx, claimsContextKey, claims) } diff --git a/firebaseauth/service.go b/firebaseauth/service.go index 4613cd5..a41e86d 100644 --- a/firebaseauth/service.go +++ b/firebaseauth/service.go @@ -8,11 +8,11 @@ type Service interface { Authentication( ctx context.Context, ah string, - ) (string, map[string]interface{}, error) + ) (string, map[string]any, error) SetCustomClaims( ctx context.Context, userID string, - claims map[string]interface{}, + claims map[string]any, ) error } diff --git a/firebaseauth/service_debug.go b/firebaseauth/service_debug.go index af7935f..0666c12 100644 --- a/firebaseauth/service_debug.go +++ b/firebaseauth/service_debug.go @@ -8,10 +8,10 @@ import ( type serviceDebug struct { sFirebaseAuth Service - dummyClaims map[string]interface{} + dummyClaims map[string]any } -func NewServiceDebug(cFirebaseAuth *auth.Client, dummyClaims map[string]interface{}) Service { +func NewServiceDebug(cFirebaseAuth *auth.Client, dummyClaims map[string]any) Service { sFirebaseAuth := NewService(cFirebaseAuth) return &serviceDebug{ sFirebaseAuth, @@ -20,7 +20,7 @@ func NewServiceDebug(cFirebaseAuth *auth.Client, dummyClaims map[string]interfac } // 認証を行う -func (s *serviceDebug) Authentication(ctx context.Context, ah string) (string, map[string]interface{}, error) { +func (s *serviceDebug) Authentication(ctx context.Context, ah string) (string, map[string]any, error) { // AuthorizationHeaderからUserが取得できたらデバッグリクエストと判定する if user := getUserByAuthHeader(ah); user != "" { return user, s.dummyClaims, nil @@ -29,7 +29,7 @@ func (s *serviceDebug) Authentication(ctx context.Context, ah string) (string, m } // カスタムClaimsを設定 -func (s *serviceDebug) SetCustomClaims(ctx context.Context, userID string, claims map[string]interface{}) error { +func (s *serviceDebug) SetCustomClaims(ctx context.Context, userID string, claims map[string]any) error { // AuthorizationHeaderからUserが取得できたらデバッグリクエストと判定する ah := getAuthHeader(ctx) if getUserByAuthHeader(ah) != "" { diff --git a/firebaseauth/service_impl.go b/firebaseauth/service_impl.go index 8c8fede..7c6e4a8 100644 --- a/firebaseauth/service_impl.go +++ b/firebaseauth/service_impl.go @@ -16,7 +16,7 @@ func NewService(cFirebaseAuth *auth.Client) Service { } // 認証を行う -func (s *service) Authentication(ctx context.Context, ah string) (string, map[string]interface{}, error) { +func (s *service) Authentication(ctx context.Context, ah string) (string, map[string]any, error) { token := getTokenByAuthHeader(ah) if token == "" { err := log.Warninge(ctx, "token empty error") @@ -32,7 +32,7 @@ func (s *service) Authentication(ctx context.Context, ah string) (string, map[st } // カスタムClaimsを設定 -func (s *service) SetCustomClaims(ctx context.Context, userID string, claims map[string]interface{}) error { +func (s *service) SetCustomClaims(ctx context.Context, userID string, claims map[string]any) error { err := s.cFirebaseAuth.SetCustomUserClaims(ctx, userID, claims) if err != nil { log.Error(ctx, err) diff --git a/flexiblecsv/stream.go b/flexiblecsv/stream.go index e1e1355..d40175d 100644 --- a/flexiblecsv/stream.go +++ b/flexiblecsv/stream.go @@ -13,7 +13,7 @@ type CSVWriter interface { } type StreamMarshaler interface { - Marshal(row interface{}) error + Marshal(row any) error Flush() error } @@ -33,7 +33,7 @@ func MarshalFileAsStream(file *os.File) StreamMarshaler { return NewStreamMarshaler(csv.NewWriter(file)) } -func (s *streamMarshaler) Marshal(row interface{}) error { +func (s *streamMarshaler) Marshal(row any) error { if s.isFirst { // Headerを取得 header := []string{} diff --git a/flexiblecsv/util.go b/flexiblecsv/util.go index 08d6275..8f4ace5 100644 --- a/flexiblecsv/util.go +++ b/flexiblecsv/util.go @@ -9,7 +9,7 @@ import ( "reflect" ) -func MarshalString(srcs interface{}) (string, error) { +func MarshalString(srcs any) (string, error) { records, err := marshal(srcs) if err != nil { return "", err @@ -27,7 +27,7 @@ func MarshalString(srcs interface{}) (string, error) { return buf.String(), nil } -func MarshalFile(srcs interface{}, file *os.File) error { +func MarshalFile(srcs any, file *os.File) error { records, err := marshal(srcs) if err != nil { return err @@ -44,7 +44,7 @@ func MarshalFile(srcs interface{}, file *os.File) error { return nil } -func marshal(srcs interface{}) ([][]string, error) { +func marshal(srcs any) ([][]string, error) { // Pointerの場合は参照先を取得 rvs := reflect.Indirect(reflect.ValueOf(srcs)) diff --git a/go.mod b/go.mod index 01bae74..3e73d0e 100644 --- a/go.mod +++ b/go.mod @@ -3,11 +3,11 @@ module github.com/rabee-inc/go-pkg go 1.19 require ( - cloud.google.com/go/bigquery v1.44.0 - cloud.google.com/go/cloudtasks v1.8.0 + cloud.google.com/go/bigquery v1.47.0 + cloud.google.com/go/cloudtasks v1.9.0 cloud.google.com/go/firestore v1.9.0 - cloud.google.com/go/pubsub v1.27.1 - cloud.google.com/go/storage v1.28.1 + cloud.google.com/go/pubsub v1.28.0 + cloud.google.com/go/storage v1.29.0 firebase.google.com/go v3.13.0+incompatible github.com/davecgh/go-spew v1.1.1 github.com/go-chi/chi v1.5.4 @@ -17,37 +17,53 @@ require ( github.com/unrolled/render v1.5.0 github.com/vincent-petithory/dataurl v1.0.0 golang.org/x/sync v0.1.0 - golang.org/x/text v0.6.0 - google.golang.org/api v0.103.0 - google.golang.org/grpc v1.51.0 + golang.org/x/text v0.7.0 + google.golang.org/api v0.110.0 + google.golang.org/grpc v1.53.0 gopkg.in/go-playground/validator.v9 v9.31.0 gopkg.in/yaml.v3 v3.0.1 ) require ( - cloud.google.com/go v0.108.0 // indirect - cloud.google.com/go/compute v1.15.1 // indirect + cloud.google.com/go v0.110.0 // indirect + cloud.google.com/go/compute v1.18.0 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v0.10.0 // indirect - cloud.google.com/go/longrunning v0.4.0 // indirect + cloud.google.com/go/iam v0.12.0 // indirect + cloud.google.com/go/longrunning v0.4.1 // indirect + github.com/andybalholm/brotli v1.0.5 // indirect + github.com/apache/arrow/go/v10 v10.0.1 // indirect + github.com/apache/thrift v0.18.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/go-playground/locales v0.14.1 // indirect - github.com/go-playground/universal-translator v0.18.0 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/goccy/go-json v0.10.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/google/flatbuffers v23.1.21+incompatible // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/uuid v1.3.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.2.1 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect github.com/googleapis/gax-go/v2 v2.7.0 // indirect + github.com/klauspost/asmfmt v1.3.2 // indirect + github.com/klauspost/compress v1.15.15 // indirect + github.com/klauspost/cpuid/v2 v2.2.4 // indirect + github.com/kr/text v0.2.0 // indirect github.com/leodido/go-urn v1.2.1 // indirect + github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 // indirect + github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 // indirect + github.com/pierrec/lz4/v4 v4.1.17 // indirect + github.com/zeebo/xxh3 v1.0.2 // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/net v0.5.0 // indirect - golang.org/x/oauth2 v0.4.0 // indirect - golang.org/x/sys v0.4.0 // indirect + golang.org/x/mod v0.8.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/oauth2 v0.5.0 // indirect + golang.org/x/sys v0.5.0 // indirect golang.org/x/time v0.3.0 // indirect + golang.org/x/tools v0.6.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20221205194025-8222ab48f5fc // indirect + google.golang.org/genproto v0.0.0-20230223222841-637eb2293923 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/go-playground/assert.v1 v1.2.1 // indirect ) diff --git a/go.sum b/go.sum index bb5ca50..664c20a 100644 --- a/go.sum +++ b/go.sum @@ -1,33 +1,41 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.108.0 h1:xntQwnfn8oHGX0crLVinvHM+AhXvi3QHQIEcX/2hiWk= -cloud.google.com/go v0.108.0/go.mod h1:lNUfQqusBJp0bgAg6qrHgYFYbTB+dOiob1itwnlD33Q= -cloud.google.com/go/bigquery v1.44.0 h1:Wi4dITi+cf9VYp4VH2T9O41w0kCW0uQTELq2Z6tukN0= -cloud.google.com/go/bigquery v1.44.0/go.mod h1:0Y33VqXTEsbamHJvJHdFmtqHvMIY28aK1+dFsvaChGc= -cloud.google.com/go/cloudtasks v1.8.0 h1:faUiUgXjW8yVZ7XMnKHKm1WE4OldPBUWWfIRN/3z1dc= -cloud.google.com/go/cloudtasks v1.8.0/go.mod h1:gQXUIwCSOI4yPVK7DgTVFiiP0ZW/eQkydWzwVMdHxrI= -cloud.google.com/go/compute v1.15.1 h1:7UGq3QknM33pw5xATlpzeoomNxsacIVvTqTTvbfajmE= -cloud.google.com/go/compute v1.15.1/go.mod h1:bjjoF/NtFUrkD/urWfdHaKuOPDR5nWIs63rR+SXhcpA= +cloud.google.com/go v0.110.0 h1:Zc8gqp3+a9/Eyph2KDmcGaPtbKRIoqq4YTlL4NMD0Ys= +cloud.google.com/go v0.110.0/go.mod h1:SJnCLqQ0FCFGSZMUNUf84MV3Aia54kn7pi8st7tMzaY= +cloud.google.com/go/bigquery v1.47.0 h1:p75CbwOe91ojFIlljAlNm8jQlkeDFeCScfz0b1Xr2Dk= +cloud.google.com/go/bigquery v1.47.0/go.mod h1:sA9XOgy0A8vQK9+MWhEQTY6Tix87M/ZurWFIxmF9I/E= +cloud.google.com/go/cloudtasks v1.9.0 h1:Cc2/20hMhGLV2pBGk/i6zNY+eTT9IsV3mrK6TKBu3gs= +cloud.google.com/go/cloudtasks v1.9.0/go.mod h1:w+EyLsVkLWHcOaqNEyvcKAsWp9p29dL6uL9Nst1cI7Y= +cloud.google.com/go/compute v1.18.0 h1:FEigFqoDbys2cvFkZ9Fjq4gnHBP55anJ0yQyau2f9oY= +cloud.google.com/go/compute v1.18.0/go.mod h1:1X7yHxec2Ga+Ss6jPyjxRxpu2uu7PLgsOVXvgU0yacs= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= -cloud.google.com/go/datacatalog v1.8.0 h1:6kZ4RIOW/uT7QWC5SfPfq/G8sYzr/v+UOmOAxy4Z1TE= +cloud.google.com/go/datacatalog v1.8.1 h1:8R4W1f3YINUhK/QldgGLH8L4mu4/bsOIz5eeyD+eH1w= cloud.google.com/go/firestore v1.9.0 h1:IBlRyxgGySXu5VuW0RgGFlTtLukSnNkpDiEOMkQkmpA= cloud.google.com/go/firestore v1.9.0/go.mod h1:HMkjKHNTtRyZNiMzu7YAsLr9K3X2udY2AMwDaMEQiiE= -cloud.google.com/go/iam v0.10.0 h1:fpP/gByFs6US1ma53v7VxhvbJpO2Aapng6wabJ99MuI= -cloud.google.com/go/iam v0.10.0/go.mod h1:nXAECrMt2qHpF6RZUZseteD6QyanL68reN4OXPw0UWM= +cloud.google.com/go/iam v0.12.0 h1:DRtTY29b75ciH6Ov1PHb4/iat2CLCvrOm40Q0a6DFpE= +cloud.google.com/go/iam v0.12.0/go.mod h1:knyHGviacl11zrtZUoDuYpDgLjvr28sLQaG0YB2GYAY= cloud.google.com/go/kms v1.6.0 h1:OWRZzrPmOZUzurjI2FBGtgY2mB1WaJkqhw6oIwSj0Yg= -cloud.google.com/go/longrunning v0.4.0 h1:v+X4EwhHl6xE+TG1XgXj4T1XpKKs7ZevcAJ3FOu0YmY= -cloud.google.com/go/longrunning v0.4.0/go.mod h1:eF3Qsw58iX/bkKtVjMTYpH0LRjQ2goDkjkNQTlzq/ZM= -cloud.google.com/go/pubsub v1.27.1 h1:q+J/Nfr6Qx4RQeu3rJcnN48SNC0qzlYzSeqkPq93VHs= -cloud.google.com/go/pubsub v1.27.1/go.mod h1:hQN39ymbV9geqBnfQq6Xf63yNhUAhv9CZhzp5O6qsW0= -cloud.google.com/go/storage v1.28.1 h1:F5QDG5ChchaAVQhINh24U99OWHURqrW8OmQcGKXcbgI= -cloud.google.com/go/storage v1.28.1/go.mod h1:Qnisd4CqDdo6BGs2AD5LLnEsmSQ80wQ5ogcBBKhU86Y= +cloud.google.com/go/longrunning v0.4.1 h1:v+yFJOfKC3yZdY6ZUI933pIYdhyhV8S3NpWrXWmg7jM= +cloud.google.com/go/longrunning v0.4.1/go.mod h1:4iWDqhBZ70CvZ6BfETbvam3T8FMvLK+eFj0E6AaRQTo= +cloud.google.com/go/pubsub v1.28.0 h1:XzabfdPx/+eNrsVVGLFgeUnQQKPGkMb8klRCeYK52is= +cloud.google.com/go/pubsub v1.28.0/go.mod h1:vuXFpwaVoIPQMGXqRyUQigu/AX1S3IWugR9xznmcXX8= +cloud.google.com/go/storage v1.29.0 h1:6weCgzRvMg7lzuUurI4697AqIRPU1SvzHhynwpW31jI= +cloud.google.com/go/storage v1.29.0/go.mod h1:4puEjyTKnku6gfKoTfNOU/W+a9JyuVNxjpS5GBrB8h4= firebase.google.com/go v3.13.0+incompatible h1:3TdYC3DDi6aHn20qoRkxwGqNgdjtblwVAyRLQwGn/+4= firebase.google.com/go v3.13.0+incompatible/go.mod h1:xlah6XbEyW6tbfSklcfe5FHJIwjt8toICdV5Wh9ptHs= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c h1:RGWPOewvKIROun94nF7v2cua9qP+thov/7M50KEoeSU= +github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= +github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/apache/arrow/go/v10 v10.0.1 h1:n9dERvixoC/1JjDmBcs9FPaEryoANa2sCgVFo6ez9cI= +github.com/apache/arrow/go/v10 v10.0.1/go.mod h1:YvhnlEePVnBS4+0z3fhPfUy7W1Ikj0Ih0vcRo/gZ1M0= +github.com/apache/thrift v0.18.0 h1:YXuoqgVIHYiAp1WhRw59wXe86HQflof8fh3llIjRzMY= +github.com/apache/thrift v0.18.0/go.mod h1:rdQn/dCcDKEWjjylUeueum4vQEjG2v8v2PqriUnbr+I= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -39,11 +47,12 @@ github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4 github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/go-chi/chi v1.5.4 h1:QHdzF2szwjqVV4wmByUnTcsbIg7UGaQ0tPF2t5GcAIs= github.com/go-chi/chi v1.5.4/go.mod h1:uaf8YgoFazUOkPBG7fxPftUylNumIev9awIWOENIuEg= -github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= -github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= -github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/goccy/go-json v0.10.0 h1:mXKd9Qw4NuzShiRlOXKews24ufknHO7gx30lsDyokKA= +github.com/goccy/go-json v0.10.0/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= @@ -62,6 +71,10 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/flatbuffers v23.1.21+incompatible h1:bUqzx/MXCDxuS0hRJL2EfjyZL3uQrPbMocUa8zGqsTA= +github.com/google/flatbuffers v23.1.21+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -71,18 +84,31 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/martian/v3 v3.2.1 h1:d8MncMlErDFTwQGBK1xhv026j9kqhvw1Qv9IbWT1VLQ= +github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.2.1 h1:RY7tHKZcRlk788d5WSo/e83gOyyy742E8GSs771ySpg= -github.com/googleapis/enterprise-certificate-proxy v0.2.1/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= +github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= +github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= github.com/googleapis/gax-go/v2 v2.7.0 h1:IcsPKeInNvYi7eqSaDjiZqDDKu5rsmunY0Y1YupQSSQ= github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= github.com/jszwec/csvutil v1.7.1 h1:btxPxFwms8lHMgl0OIgOQ4Tayfqo0xid0hGkq1kM510= github.com/jszwec/csvutil v1.7.1/go.mod h1:Rpu7Uu9giO9subDyMCIQfHVDuLrcaC36UA4YcJjGBkg= +github.com/klauspost/asmfmt v1.3.2 h1:4Ri7ox3EwapiOjCki+hw14RyKk201CN4rzyCJRFLpK4= +github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE= +github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7yIO+lw= +github.com/klauspost/compress v1.15.15/go.mod h1:ZcK2JAFqKOpnBlxcLsJzYfrS9X1akm9fHZNnD9+Vo/4= +github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= +github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= +github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 h1:AMFGa4R4MiIpspGNG7Z948v4n35fFGB3RR3G/ry4FWs= +github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY= +github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 h1:+n/aFZefKZp7spd8DFdX7uMikMLXX4oubIzJF4kv/wI= +github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/marmoset v0.4.0 h1:Hg59lQI7qQowBEdsAJ/+VDTEospTBzXX/A1Gsw4mlvA= github.com/otiai10/marmoset v0.4.0/go.mod h1:t2q6dXWZ9YcFdRREDApX4bCmfQnL3isJ2dgl8ychlXg= @@ -90,9 +116,12 @@ github.com/otiai10/mint v1.3.0 h1:Ady6MKVezQwHBkGzLFbrsywyp09Ah7rkmfjV3Bcr5uc= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/opengraph v1.1.3 h1:4RoX4yckU/eaj34XxwoyNFvuPVrmjcUHMyAgjJL1Pwg= github.com/otiai10/opengraph v1.1.3/go.mod h1:ZMbPcfiSRSsg3+yrWZCXrgYL6kEK4KpH4GG1iyIvEXs= +github.com/pierrec/lz4/v4 v4.1.17 h1:kV4Ip+/hUBC+8T6+2EgburRtkE9ef4nbY3f4dFhGjMc= +github.com/pierrec/lz4/v4 v4.1.17/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rs/xid v1.4.0 h1:qd7wPTDkN6KQx2VmMBLrpHkiyQwgFXRnkOLacUiaSNY= github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -110,14 +139,20 @@ github.com/unrolled/render v1.5.0/go.mod h1:eLTosBkQqEPEk7pRfkCRApXd++lm++nCsVlF github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/vincent-petithory/dataurl v1.0.0 h1:cXw+kPto8NLuJtlMsI152irrVw9fRDX8AbShPRpg2CI= github.com/vincent-petithory/dataurl v1.0.0/go.mod h1:FHafX5vmDzyP+1CQATJn7WFKc9CvnvxyvZy6I1MrG/U= +github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= +github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= +github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20220827204233-334a2380cb91 h1:tnebWN09GYg9OLPss1KXj8txwZc6X6uMr6VFdcGNbHw= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -126,11 +161,11 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190926025831-c00fd9afed17/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.4.0 h1:NF0gk8LVPg1Ml7SSbGyySuoxdsXitj7TvgvuRxIMc/M= -golang.org/x/oauth2 v0.4.0/go.mod h1:RznEsdpjGAINPTOF0UH/t+xJ75L18YO3Ho6Pyn+uRec= +golang.org/x/oauth2 v0.5.0 h1:HuArIo48skDwlrvM3sEdHXElYslAMsf3KwRkkW4MC4s= +golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -140,15 +175,15 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -156,11 +191,14 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -google.golang.org/api v0.103.0 h1:9yuVqlu2JCvcLg9p8S3fcFLZij8EPSyvODIY1rkMizQ= -google.golang.org/api v0.103.0/go.mod h1:hGtW6nK1AC+d9si/UBhw8Xli+QMOf6xyNAyJw4qU9w0= +gonum.org/v1/gonum v0.11.0 h1:f1IJhK4Km5tBJmaiJXtk/PkL4cdVX6J+tGiM187uT5E= +google.golang.org/api v0.110.0 h1:l+rh0KYUooe9JGbGVx71tbFo4SMbMTXK3I3ia2QSEeU= +google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= @@ -168,15 +206,15 @@ google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCID google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20221205194025-8222ab48f5fc h1:nUKKji0AarrQKh6XpFEpG3p1TNztxhe7C8TcUvDgXqw= -google.golang.org/genproto v0.0.0-20221205194025-8222ab48f5fc/go.mod h1:1dOng4TWOomJrDGhpXjfCD35wQC6jnC7HpRmOFRqEV0= +google.golang.org/genproto v0.0.0-20230223222841-637eb2293923 h1:znp6mq/drrY+6khTAlJUDNFFcDGV2ENLYKpMq8SyCds= +google.golang.org/genproto v0.0.0-20230223222841-637eb2293923/go.mod h1:3Dl5ZL0q0isWJt+FVcfpQyirqemEuLAK/iFvg1UP1Hw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= +google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= +google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -190,8 +228,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/go-playground/validator.v9 v9.31.0 h1:bmXmP2RSNtFES+bn4uYuHT7iJFJv7Vj+an+ZQdDaD1M= diff --git a/httpclient/client.go b/httpclient/client.go index 7d64ecc..ec9b742 100644 --- a/httpclient/client.go +++ b/httpclient/client.go @@ -38,7 +38,7 @@ func Get(ctx context.Context, url string, opt *HTTPOption) (int, []byte, error) } // Getリクエスト(URL, param) -func GetForm(ctx context.Context, url string, param map[string]interface{}, opt *HTTPOption) (int, []byte, error) { +func GetForm(ctx context.Context, url string, param map[string]any, opt *HTTPOption) (int, []byte, error) { req, err := http.NewRequest(http.MethodGet, url, nil) if err != nil { log.Warning(ctx, err) @@ -76,7 +76,7 @@ func GetQueryString(ctx context.Context, url string, qs string, opt *HTTPOption) } // Postリクエスト(URL, param) -func PostForm(ctx context.Context, url string, param map[string]interface{}, opt *HTTPOption) (int, []byte, error) { +func PostForm(ctx context.Context, url string, param map[string]any, opt *HTTPOption) (int, []byte, error) { values := neturl.Values{} for key, value := range param { values.Add(key, fmt.Sprintf("%v", value)) @@ -98,7 +98,7 @@ func PostForm(ctx context.Context, url string, param map[string]interface{}, opt } // Postリクエスト(URL, JSON) -func PostJSON(ctx context.Context, url string, param interface{}, res interface{}, opt *HTTPOption) (int, error) { +func PostJSON(ctx context.Context, url string, param any, res any, opt *HTTPOption) (int, error) { jp, err := json.Marshal(param) if err != nil { log.Warning(ctx, err) @@ -130,7 +130,7 @@ func PostJSON(ctx context.Context, url string, param interface{}, res interface{ err = perr } } else { - errRes := map[string]interface{}{} + errRes := map[string]any{} err = json.Unmarshal(body, &errRes) log.Warningf(ctx, "%v", errRes) } @@ -155,7 +155,7 @@ func PostBody(ctx context.Context, url string, body []byte, opt *HTTPOption) (in } // Putリクエスト(URL, JSON) -func PutJSON(ctx context.Context, url string, param interface{}, res interface{}, opt *HTTPOption) (int, error) { +func PutJSON(ctx context.Context, url string, param any, res any, opt *HTTPOption) (int, error) { jp, err := json.Marshal(param) if err != nil { log.Warning(ctx, err) @@ -187,7 +187,7 @@ func PutJSON(ctx context.Context, url string, param interface{}, res interface{} err = perr } } else { - errRes := map[string]interface{}{} + errRes := map[string]any{} err = json.Unmarshal(body, &errRes) log.Warningf(ctx, "%v", errRes) } @@ -212,7 +212,7 @@ func PutBody(ctx context.Context, url string, body []byte, opt *HTTPOption) (int } // Patchリクエスト(URL, JSON) -func PatchJSON(ctx context.Context, url string, param interface{}, res interface{}, opt *HTTPOption) (int, error) { +func PatchJSON(ctx context.Context, url string, param any, res any, opt *HTTPOption) (int, error) { jp, err := json.Marshal(param) if err != nil { log.Warning(ctx, err) @@ -244,7 +244,7 @@ func PatchJSON(ctx context.Context, url string, param interface{}, res interface err = perr } } else { - errRes := map[string]interface{}{} + errRes := map[string]any{} err = json.Unmarshal(body, &errRes) log.Warningf(ctx, "%v", errRes) } @@ -285,7 +285,7 @@ func Delete(ctx context.Context, url string, opt *HTTPOption) (int, []byte, erro } // Deleteリクエスト(URL, param) -func DeleteForm(ctx context.Context, url string, param map[string]interface{}, opt *HTTPOption) (int, []byte, error) { +func DeleteForm(ctx context.Context, url string, param map[string]any, opt *HTTPOption) (int, []byte, error) { req, err := http.NewRequest(http.MethodDelete, url, nil) if err != nil { log.Warning(ctx, err) @@ -323,7 +323,7 @@ func DeleteQueryString(ctx context.Context, url string, qs string, opt *HTTPOpti } // Deleteリクエスト(URL, JSON) -func DeleteJSON(ctx context.Context, url string, param interface{}, res interface{}, opt *HTTPOption) (int, error) { +func DeleteJSON(ctx context.Context, url string, param any, res any, opt *HTTPOption) (int, error) { jp, err := json.Marshal(param) if err != nil { log.Warning(ctx, err) @@ -355,7 +355,7 @@ func DeleteJSON(ctx context.Context, url string, param interface{}, res interfac err = perr } } else { - errRes := map[string]interface{}{} + errRes := map[string]any{} err = json.Unmarshal(body, &errRes) log.Warningf(ctx, "%v", errRes) } diff --git a/jsonrpc2/action.go b/jsonrpc2/action.go index e728ce1..862f39c 100644 --- a/jsonrpc2/action.go +++ b/jsonrpc2/action.go @@ -9,11 +9,11 @@ type Action interface { DecodeParams( ctx context.Context, msg *json.RawMessage, - ) (interface{}, error) + ) (any, error) Exec( ctx context.Context, method string, - params interface{}, - ) (interface{}, error) + params any, + ) (any, error) } diff --git a/jsonrpc2/client.go b/jsonrpc2/client.go index e71e89c..4136380 100644 --- a/jsonrpc2/client.go +++ b/jsonrpc2/client.go @@ -24,7 +24,7 @@ func NewClient(url string, headers map[string]string) *Client { } // JSONRPC2のリクエストを登録する -func (c *Client) AddRequest(ctx context.Context, id string, method string, params interface{}) error { +func (c *Client) AddRequest(ctx context.Context, id string, method string, params any) error { rawParams, err := c.marshalRawMessage(ctx, params) if err != nil { log.Error(ctx, err) @@ -40,7 +40,7 @@ func (c *Client) AddRequest(ctx context.Context, id string, method string, param } // JSONRPC2のシングルリクエストを行う -func (c *Client) DoSingle(ctx context.Context, method string, params interface{}) (*json.RawMessage, *ErrorResponse, error) { +func (c *Client) DoSingle(ctx context.Context, method string, params any) (*json.RawMessage, *ErrorResponse, error) { rawParams, err := c.marshalRawMessage(ctx, params) if err != nil { log.Error(ctx, err) @@ -81,7 +81,7 @@ func (c *Client) DoBatch(ctx context.Context) ([]*ClientResponse, error) { return res, nil } -func (c *Client) marshalRawMessage(ctx context.Context, params interface{}) (*json.RawMessage, error) { +func (c *Client) marshalRawMessage(ctx context.Context, params any) (*json.RawMessage, error) { bParams, err := json.Marshal(params) if err != nil { log.Error(ctx, err) diff --git a/jsonrpc2/handler.go b/jsonrpc2/handler.go index 1ee95d2..141fc01 100644 --- a/jsonrpc2/handler.go +++ b/jsonrpc2/handler.go @@ -130,7 +130,7 @@ func (h *Handler) handleRequest(ctx context.Context, r *http.Request, req reques return newResponse(req.ID, result) } -func (h *Handler) renderError(ctx context.Context, w http.ResponseWriter, status int, format string, a ...interface{}) { +func (h *Handler) renderError(ctx context.Context, w http.ResponseWriter, status int, format string, a ...any) { msg := fmt.Sprintf(format, a...) switch status { case http.StatusBadRequest: @@ -145,7 +145,7 @@ func (h *Handler) renderError(ctx context.Context, w http.ResponseWriter, status render.New().Text(w, status, msg) } -func (h *Handler) renderErrorJSON(ctx context.Context, rpcID string, rpcStatus int, format string, a ...interface{}) response { +func (h *Handler) renderErrorJSON(ctx context.Context, rpcID string, rpcStatus int, format string, a ...any) response { msg := fmt.Sprintf(format, a...) switch rpcStatus { case http.StatusBadRequest: diff --git a/jsonrpc2/request.go b/jsonrpc2/request.go index bc3073b..ebf7108 100644 --- a/jsonrpc2/request.go +++ b/jsonrpc2/request.go @@ -34,7 +34,7 @@ func (r *request) isValid() bool { } // JSONRPC2のリクエストBodyを作成する -func GenerateRequestBody(id string, method string, params interface{}) (*json.RawMessage, error) { +func GenerateRequestBody(id string, method string, params any) (*json.RawMessage, error) { jsonParams, err := json.Marshal(params) if err != nil { return nil, err diff --git a/jsonrpc2/response.go b/jsonrpc2/response.go index d80266c..eb24424 100644 --- a/jsonrpc2/response.go +++ b/jsonrpc2/response.go @@ -13,7 +13,7 @@ type ClientResponse struct { type response struct { Version string `json:"jsonrpc"` ID string `json:"id"` - Result interface{} `json:"result,omitempty"` + Result any `json:"result,omitempty"` Error *ErrorResponse `json:"error,omitempty"` } @@ -23,7 +23,7 @@ type ErrorResponse struct { Message string `json:"message"` } -func newResponse(id string, result interface{}) response { +func newResponse(id string, result any) response { return response{ Version: version, ID: id, diff --git a/log/const.go b/log/const.go index a876662..5c9b3bb 100644 --- a/log/const.go +++ b/log/const.go @@ -82,7 +82,7 @@ func (d Duration) MarshalJSON() ([]byte, error) { nanos := time.Duration(d).Nanoseconds() secs := nanos / 1e9 nanos -= secs * 1e9 - v := make(map[string]interface{}) + v := make(map[string]any) v["seconds"] = int64(secs) v["nanos"] = int32(nanos) return json.Marshal(v) diff --git a/log/logger.go b/log/logger.go index 73e712b..130bc4f 100644 --- a/log/logger.go +++ b/log/logger.go @@ -103,7 +103,7 @@ func Debug(ctx context.Context, err error) { } // Debugf ... Debugログを出力する -func Debugf(ctx context.Context, format string, args ...interface{}) { +func Debugf(ctx context.Context, format string, args ...any) { severity := SeverityDebug logger := GetLogger(ctx) if logger != nil && logger.IsLogging(severity) { @@ -124,7 +124,7 @@ func Debugf(ctx context.Context, format string, args ...interface{}) { } // Debuge ... Debugログを出力してエラーを生成する -func Debuge(ctx context.Context, format string, args ...interface{}) error { +func Debuge(ctx context.Context, format string, args ...any) error { err := fmt.Errorf(format, args...) severity := SeverityDebug logger := GetLogger(ctx) @@ -147,7 +147,7 @@ func Debuge(ctx context.Context, format string, args ...interface{}) error { } // Debugc ... Debugログを出力してコード付きのエラーを生成する -func Debugc(ctx context.Context, code int, format string, args ...interface{}) error { +func Debugc(ctx context.Context, code int, format string, args ...any) error { err := fmt.Errorf(format, args...) severity := SeverityDebug logger := GetLogger(ctx) @@ -191,7 +191,7 @@ func Info(ctx context.Context, err error) { } // Infof ... Infoログを出力する -func Infof(ctx context.Context, format string, args ...interface{}) { +func Infof(ctx context.Context, format string, args ...any) { severity := SeverityInfo logger := GetLogger(ctx) if logger != nil && logger.IsLogging(severity) { @@ -212,7 +212,7 @@ func Infof(ctx context.Context, format string, args ...interface{}) { } // Infoe ... Infoログを出力してエラーを生成する -func Infoe(ctx context.Context, format string, args ...interface{}) error { +func Infoe(ctx context.Context, format string, args ...any) error { err := fmt.Errorf(format, args...) severity := SeverityInfo logger := GetLogger(ctx) @@ -235,7 +235,7 @@ func Infoe(ctx context.Context, format string, args ...interface{}) error { } // Infoc ... Infoログを出力してコード付きのエラーを生成する -func Infoc(ctx context.Context, code int, format string, args ...interface{}) error { +func Infoc(ctx context.Context, code int, format string, args ...any) error { err := fmt.Errorf(format, args...) severity := SeverityInfo logger := GetLogger(ctx) @@ -279,7 +279,7 @@ func Warning(ctx context.Context, err error) { } // Warningf ... Warningログを出力する -func Warningf(ctx context.Context, format string, args ...interface{}) { +func Warningf(ctx context.Context, format string, args ...any) { severity := SeverityWarning logger := GetLogger(ctx) if logger != nil && logger.IsLogging(severity) { @@ -300,7 +300,7 @@ func Warningf(ctx context.Context, format string, args ...interface{}) { } // Warninge ... Warningログを出力してエラーを生成する -func Warninge(ctx context.Context, format string, args ...interface{}) error { +func Warninge(ctx context.Context, format string, args ...any) error { err := fmt.Errorf(format, args...) severity := SeverityWarning logger := GetLogger(ctx) @@ -323,7 +323,7 @@ func Warninge(ctx context.Context, format string, args ...interface{}) error { } // Warningc ... Warningログを出力してコード付きのエラーを生成する -func Warningc(ctx context.Context, code int, format string, args ...interface{}) error { +func Warningc(ctx context.Context, code int, format string, args ...any) error { err := fmt.Errorf(format, args...) severity := SeverityWarning logger := GetLogger(ctx) @@ -367,7 +367,7 @@ func Error(ctx context.Context, err error) { } // Errorf ... Errorログを出力する -func Errorf(ctx context.Context, format string, args ...interface{}) { +func Errorf(ctx context.Context, format string, args ...any) { severity := SeverityError logger := GetLogger(ctx) if logger != nil && logger.IsLogging(severity) { @@ -388,7 +388,7 @@ func Errorf(ctx context.Context, format string, args ...interface{}) { } // Errore ... Errorログを出力してエラーを生成する -func Errore(ctx context.Context, format string, args ...interface{}) error { +func Errore(ctx context.Context, format string, args ...any) error { err := fmt.Errorf(format, args...) severity := SeverityError logger := GetLogger(ctx) @@ -411,7 +411,7 @@ func Errore(ctx context.Context, format string, args ...interface{}) error { } // Errorc ... Errorログを出力してコード付きのエラーを生成する -func Errorc(ctx context.Context, code int, format string, args ...interface{}) error { +func Errorc(ctx context.Context, code int, format string, args ...any) error { err := fmt.Errorf(format, args...) severity := SeverityError logger := GetLogger(ctx) @@ -455,7 +455,7 @@ func Critical(ctx context.Context, err error) { } // Criticalf ... Criticalログを出力する -func Criticalf(ctx context.Context, format string, args ...interface{}) { +func Criticalf(ctx context.Context, format string, args ...any) { severity := SeverityCritical logger := GetLogger(ctx) if logger != nil && logger.IsLogging(severity) { @@ -476,7 +476,7 @@ func Criticalf(ctx context.Context, format string, args ...interface{}) { } // Criticale ... Criticalログを出力してエラーを生成する -func Criticale(ctx context.Context, format string, args ...interface{}) error { +func Criticale(ctx context.Context, format string, args ...any) error { err := fmt.Errorf(format, args...) severity := SeverityCritical logger := GetLogger(ctx) @@ -499,7 +499,7 @@ func Criticale(ctx context.Context, format string, args ...interface{}) error { } // Criticalc ... Criticalログを出力してコード付きのエラーを生成する -func Criticalc(ctx context.Context, code int, format string, args ...interface{}) error { +func Criticalc(ctx context.Context, code int, format string, args ...any) error { err := fmt.Errorf(format, args...) severity := SeverityCritical logger := GetLogger(ctx) @@ -522,7 +522,7 @@ func Criticalc(ctx context.Context, code int, format string, args ...interface{} } // Panic ... Panicをハンドリングする -func Panic(ctx context.Context, rcvr interface{}) string { +func Panic(ctx context.Context, rcvr any) string { traces := []string{} for depth := 0; ; depth++ { if depth < 2 { diff --git a/memcache/client.go b/memcache/client.go index f693a57..ba39de3 100644 --- a/memcache/client.go +++ b/memcache/client.go @@ -13,7 +13,7 @@ type Client struct { } // GetOrSet ... キャッシュを取得(設定)する -func (c *Client) GetOrSet(key string, fn func(key string) (interface{}, int, error)) (interface{}, error) { +func (c *Client) GetOrSet(key string, fn func(key string) (any, int, error)) (any, error) { c.mutex.Lock() defer c.mutex.Unlock() diff --git a/memcache/model.go b/memcache/model.go index e2d907f..3c2859d 100644 --- a/memcache/model.go +++ b/memcache/model.go @@ -2,6 +2,6 @@ package memcache // Datum ... インメモリキャッシュ type Datum struct { - Value interface{} + Value any ExpiredAt int64 } diff --git a/parameter/parameter.go b/parameter/parameter.go index f6938ae..217c0f5 100644 --- a/parameter/parameter.go +++ b/parameter/parameter.go @@ -172,7 +172,7 @@ func GetFormByIntSlice(ctx context.Context, r *http.Request, key string) []int { } // GetForms ... リクエストからFormパラメータを取得する -func GetForms(ctx context.Context, r *http.Request, dst interface{}) error { +func GetForms(ctx context.Context, r *http.Request, dst any) error { if reflect.TypeOf(dst).Kind() != reflect.Ptr { err := log.Errore(ctx, "dst isn't a pointer") return err @@ -237,7 +237,7 @@ func GetForms(ctx context.Context, r *http.Request, dst interface{}) error { } // GetJSON ... リクエストからJSONパラメータを取得する -func GetJSON(r *http.Request, dst interface{}) error { +func GetJSON(r *http.Request, dst any) error { dec := json.NewDecoder(r.Body) err := dec.Decode(dst) if err != nil { diff --git a/randutil/util.go b/randutil/util.go index 43eb9bd..5ce141b 100644 --- a/randutil/util.go +++ b/randutil/util.go @@ -14,19 +14,19 @@ func seed() { rand.Seed(time.Now().UnixNano()) } -// Bool ... 指定確率でbool値を生成する +// 指定確率でbool値を生成する func Bool(rate float32) bool { seed() return rand.Float32()*100 < rate } -// Int ... 指定範囲の乱数を生成する +// 指定範囲の乱数を生成する func Int(min int, max int) int { seed() return rand.Intn((max+1)-min) + min } -// String ... nビットのランダムな文字列を生成する +// nビットのランダムな文字列を生成する func String(n int) (string, error) { buf := make([]byte, n) if _, err := rand.Read(buf); err != nil { @@ -46,7 +46,7 @@ func String(n int) (string, error) { return string(buf), nil } -// StringByChar ... nビットのランダムな文字列を生成する +// nビットのランダムな文字列を生成する func StringByChar(n int, cr string) (string, error) { buf := make([]byte, n) if _, err := rand.Read(buf); err != nil { diff --git a/renderer/renderer.go b/renderer/renderer.go index bf92ad7..839ec82 100644 --- a/renderer/renderer.go +++ b/renderer/renderer.go @@ -71,14 +71,14 @@ func Error(ctx context.Context, w http.ResponseWriter, status int, msg string) { } // JSON ... JSONをレンダリングする -func JSON(ctx context.Context, w http.ResponseWriter, status int, v interface{}) { +func JSON(ctx context.Context, w http.ResponseWriter, status int, v any) { r := render.New() r.JSON(w, status, v) log.SetResponseStatus(ctx, status) } // HTML ... HTMLをレンダリングする -func HTML(ctx context.Context, w http.ResponseWriter, status int, name string, values interface{}) { +func HTML(ctx context.Context, w http.ResponseWriter, status int, name string, values any) { r := render.New() r.HTML(w, status, name, values) log.SetResponseStatus(ctx, status) diff --git a/sliceutil/stream.go b/sliceutil/stream.go index efbcd08..2e1bd84 100644 --- a/sliceutil/stream.go +++ b/sliceutil/stream.go @@ -9,7 +9,7 @@ type Stream struct { slice reflect.Value } -func StreamOf(slice interface{}) *Stream { +func StreamOf(slice any) *Stream { rv := reflect.ValueOf(slice) return &Stream{ slice: rv, @@ -23,7 +23,7 @@ dst := StreamOf(hoges). }).Out().([]*Hoge) */ // 要素のフィルタリング -func (s *Stream) Filter(fn interface{}) *Stream { +func (s *Stream) Filter(fn any) *Stream { frv := reflect.ValueOf(fn) srv := reflect.MakeSlice(s.slice.Type(), 0, 0) for i := 0; i < s.slice.Len(); i++ { @@ -44,7 +44,7 @@ dst := StreamOf(hoges). }).Out().([]string) */ // 要素の変換 -func (s *Stream) Map(fn interface{}) *Stream { +func (s *Stream) Map(fn any) *Stream { frv := reflect.ValueOf(fn) srt := reflect.SliceOf(frv.Type().Out(0)) srv := reflect.MakeSlice(srt, 0, 0) @@ -64,7 +64,7 @@ dst := StreamOf(hoges). }).(int) */ // 要素の集計 -func (s *Stream) Reduce(fn interface{}) interface{} { +func (s *Stream) Reduce(fn any) any { frv := reflect.ValueOf(fn) rt := frv.Type().Out(0) dst := reflect.New(rt).Elem() @@ -83,7 +83,7 @@ dst := StreamOf(hoges). }).Out().([]*Hoge) */ // ソート -func (s *Stream) Sort(fn interface{}) *Stream { +func (s *Stream) Sort(fn any) *Stream { frv := reflect.ValueOf(fn) slice := s.slice.Interface() sort.SliceStable(slice, func(i, j int) bool { @@ -101,7 +101,7 @@ dst := StreamOf(hoges). }) */ // 要素の存在確認 -func (s *Stream) Contains(fn interface{}) bool { +func (s *Stream) Contains(fn any) bool { frv := reflect.ValueOf(fn) for i := 0; i < s.slice.Len(); i++ { rv := s.slice.Index(i) @@ -120,7 +120,7 @@ dst := StreamOf(hoges). }) */ // 要素のループ -func (s *Stream) ForEach(fn interface{}) *Stream { +func (s *Stream) ForEach(fn any) *Stream { frv := reflect.ValueOf(fn) if frv.Type().NumIn() == 1 { for i := 0; i < s.slice.Len(); i++ { @@ -145,6 +145,6 @@ func (s *Stream) Count() int { } // 結果を出力する -func (s *Stream) Out() interface{} { +func (s *Stream) Out() any { return s.slice.Interface() } diff --git a/sliceutil/util.go b/sliceutil/util.go index e3e7b97..23a5109 100644 --- a/sliceutil/util.go +++ b/sliceutil/util.go @@ -2,6 +2,51 @@ package sliceutil import "github.com/rabee-inc/go-pkg/randutil" +func Filter[T any](srcs []T, fn func(src T) bool) []T { + dsts := []T{} + for _, src := range srcs { + if fn(src) { + dsts = append(dsts, src) + } + } + return dsts +} + +func Map[T, E any](srcs []T, fn func(src T) E) []E { + dsts := []E{} + for _, src := range srcs { + dsts = append(dsts, fn(src)) + } + return dsts +} + +func Reduce[T, E any](srcs []T, fn func(dst E, src T) E) E { + var dst E + for _, src := range srcs { + dst = fn(dst, src) + } + return dst +} + +// 配列の値の存在確認 +func Contains[T comparable](srcs []T, e T) bool { + for _, v := range srcs { + if e == v { + return true + } + } + return false +} + +func ContainsFunc[T any](srcs []T, fn func(src T) bool) bool { + for _, src := range srcs { + if fn(src) { + return true + } + } + return false +} + // 配列をシャッフルする func Shuffle[T any](srcs []T) []T { n := len(srcs) @@ -45,16 +90,6 @@ func Uniq[T comparable](srcs []T) []T { return dsts } -// 配列の値の存在確認 -func Contains[T comparable](srcs []T, e T) bool { - for _, v := range srcs { - if e == v { - return true - } - } - return false -} - // 配列の分割 func Chunk[T any](srcs []T, size int) [][]T { var chunks [][]T diff --git a/stringutil/util.go b/stringutil/util.go index 8f1b9a1..a8aa779 100644 --- a/stringutil/util.go +++ b/stringutil/util.go @@ -10,24 +10,24 @@ import ( "github.com/rs/xid" ) -// ToBytes ... 文字列をバイト列に変換する +// 文字列をバイト列に変換する func ToBytes(str string) []byte { return *(*[]byte)(unsafe.Pointer(&str)) } -// UniqueID ... ユニークでソータブルなIDを作成する +// ユニークでソータブルなIDを作成する func UniqueID() string { guid := xid.New() return guid.String() } -// IsNumeric ... 数字か確認する +// 数字か確認する func IsNumeric(s string) bool { _, err := strconv.ParseFloat(s, 64) return err == nil } -// ToComma ... 数字を金額表記にする +// 数字を金額表記にする func ToComma(v int64) string { sign := "" if v == math.MinInt64 { @@ -54,7 +54,7 @@ func ToComma(v int64) string { return sign + strings.Join(parts[j:], ",") } -// ToCommaf ... 数字を金額表記にする +// 数字を金額表記にする func ToCommaf(v float64) string { buf := &bytes.Buffer{} if v < 0 { diff --git a/timeutil/util.go b/timeutil/util.go index 22dfcb1..6623ce3 100644 --- a/timeutil/util.go +++ b/timeutil/util.go @@ -4,54 +4,54 @@ import ( "time" ) -// Now ... 現在時刻をJSTのTimeで取得する +// 現在時刻をJSTのTimeで取得する func Now() time.Time { return time.Now().In(ZoneJST()) } -// NowUnix ... 現在時刻をJSTのUnixtimestamp(ミリ秒)で取得する +// 現在時刻をJSTのUnixTime(ミリ秒)で取得する func NowUnix() int64 { return time.Now().In(ZoneJST()).UnixNano() / int64(time.Millisecond) } -// ByUnix ... Unixtimestamp(ミリ秒)からJSTのTimeを取得する +// UnixTime(ミリ秒)からJSTのTimeを取得する func ByUnix(u int64) time.Time { uNano := u * 1000 * 1000 uSec := u / 1000 return time.Unix(uSec, uNano-(uSec*1000*1000*1000)).In(ZoneJST()) } -// ToUnix ... TimeからUnixtimestamp(ミリ秒)に変換する +// TimeからUnixTime(ミリ秒)に変換する func ToUnix(t time.Time) int64 { return t.UnixNano() / int64(time.Millisecond) } -// ZoneJST ... 日本のタイムゾーンを取得する +// 日本のタイムゾーンを取得する func ZoneJST() *time.Location { return time.FixedZone("Asia/Tokyo", 9*60*60) } -// SecondsToMilliseconds ... 指定秒数をミリ秒に変換する +// 指定秒数をミリ秒に変換する func SecondsToMilliseconds(seconds int) int64 { return int64(seconds * 1000) } -// MinutesToMilliseconds ... 指定分数をミリ秒に変換する +// 指定分数をミリ秒に変換する func MinutesToMilliseconds(minutes int) int64 { return int64(minutes * 60 * 1000) } -// HoursToMilliseconds ... 指定時数をミリ秒に変換する +// 指定時数をミリ秒に変換する func HoursToMilliseconds(hours int) int64 { return int64(hours * 60 * 60 * 1000) } -// DaysToMilliseconds ... 指定日数をミリ秒に変換する +// 指定日数をミリ秒に変換する func DaysToMilliseconds(days int) int64 { return int64(days * 24 * 60 * 60 * 1000) } -// IsToday ... 本日か判定する +// 本日か判定する func IsToday(u int64) bool { t := Now() startTime := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, ZoneJST()) @@ -59,7 +59,7 @@ func IsToday(u int64) bool { return ToUnix(startTime) <= u && u <= ToUnix(endTime) } -// DayPeriod ... 日の範囲(0:00:00〜23:59:59)を取得する +// 日の範囲(0:00:00〜23:59:59)を取得する func DayPeriod(at int64, diff int) (int64, int64) { t := ByUnix(at) t = t.AddDate(0, 0, diff) @@ -68,7 +68,7 @@ func DayPeriod(at int64, diff int) (int64, int64) { return ToUnix(startTime), ToUnix(endTime) } -// MonthPeriod ... 月の範囲(1日0:00:00〜最終日23:59:59)を取得する +// 月の範囲(1日0:00:00〜最終日23:59:59)を取得する func MonthPeriod(at int64, diff int) (int64, int64) { t := ByUnix(at) t = t.AddDate(0, diff, 0) @@ -77,7 +77,7 @@ func MonthPeriod(at int64, diff int) (int64, int64) { return ToUnix(startTime), ToUnix(endTime) } -// YearPeriod ... 年の範囲(12月1日0:00:00〜12月31日23:59:59)を取得する +// 年の範囲(12月1日0:00:00〜12月31日23:59:59)を取得する func YearPeriod(at int64, diff int) (int64, int64) { t := ByUnix(at) t = t.AddDate(diff, 0, 0) @@ -86,14 +86,14 @@ func YearPeriod(at int64, diff int) (int64, int64) { return ToUnix(startTime), ToUnix(endTime) } -// LastDayByMonth ... 月の最終日を取得する +// 月の最終日を取得する func LastDayByMonth(at int64) int { t := ByUnix(at) t = time.Date(t.Year(), t.Month(), 1, 23, 59, 59, 0, ZoneJST()).AddDate(0, 1, -1) return t.Day() } -// GetWeekJP ... 曜日(日本語)を取得する +// 曜日(日本語)を取得する func GetWeekJP(t time.Time) string { var week string switch t.Weekday() { diff --git a/validation/message.go b/validation/message.go index 5355b29..c956429 100644 --- a/validation/message.go +++ b/validation/message.go @@ -6,9 +6,8 @@ import ( "net/http" "strings" - "gopkg.in/go-playground/validator.v9" - "github.com/rabee-inc/go-pkg/errcode" + "gopkg.in/go-playground/validator.v9" ) func ConvertErrorMessage(err error, prefix string, fn func(tag, field, value string) string) error { diff --git a/validation/util.go b/validation/util.go index 102cd46..6cef577 100644 --- a/validation/util.go +++ b/validation/util.go @@ -1,7 +1,7 @@ package validation -// IsZero ... 値がゼロ値かどうかを判断する(true: ゼロ値, false: ゼロ値以外) -func IsZero(val interface{}) bool { +// 値がゼロ値かどうかを判断する(true: ゼロ値, false: ゼロ値以外) +func IsZero(val any) bool { switch val.(type) { case nil: return true