Skip to content
This repository has been archived by the owner on Aug 25, 2023. It is now read-only.

Commit

Permalink
Merge pull request #318 from aholovko/go_1.18
Browse files Browse the repository at this point in the history
chore: update to Go 1.18
  • Loading branch information
fqutishat authored Jul 19, 2022
2 parents 740622e + 141b538 commit 3a2f412
Show file tree
Hide file tree
Showing 22 changed files with 48 additions and 2,883 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
name: "kms ci"

env:
GO_VERSION: 1.17
GO_VERSION: 1.18

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
name: "kms release"

env:
GO_VERSION: 1.17
GO_VERSION: 1.18

on:
push:
Expand Down
14 changes: 14 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#

run:
go: 1.17
concurrency: 4
deadline: 3m
issues-exit-code: 1
Expand Down Expand Up @@ -32,6 +33,11 @@ linters-settings:
simplify: true
goimports:
local-prefixes: github.com/trustbloc/kms
gci:
sections:
- standard
- default
- prefix(github.com/trustbloc/kms)
gocyclo:
min-complexity: 15
cyclop:
Expand Down Expand Up @@ -91,6 +97,14 @@ linters:
- forbidigo
- wrapcheck
- stylecheck
- varnamelen
- tagliatelle
- maintidx
- ifshort
- golint # deprecated
- ireturn
- forcetypeassert
- promlinter

issues:
exclude-use-default: false
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0

GOBIN_PATH =$(abspath .)/build/bin
LINT_VERSION ?=v1.39.0
LINT_VERSION ?=v1.44.2
MOCK_VERSION ?=v1.6.0
SWAGGER_VERSION ?=v0.27.0
SWAGGER_DIR ="./test/bdd/fixtures/specs"
Expand All @@ -13,7 +13,7 @@ DOCKER_OUTPUT_NS ?=ghcr.io
KMS_SERVER_IMAGE_NAME ?=trustbloc/kms

ALPINE_VER ?= 3.14
GO_VER ?= 1.17
GO_VER ?= 1.18

OS := $(shell uname)
ifeq ($(OS),$(filter $(OS),Darwin Linux))
Expand Down
6 changes: 5 additions & 1 deletion cmd/kms-cli/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright SecureKey Technologies Inc. All Rights Reserved.
//
// SPDX-License-Identifier: Apache-2.0

module github.com/trustbloc/kms/cmd/kms-cli

go 1.17
go 1.18

require (
github.com/spf13/cobra v1.3.0
Expand Down
173 changes: 0 additions & 173 deletions cmd/kms-cli/go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cmd/kms-server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module github.com/trustbloc/kms/cmd/kms-server

go 1.17
go 1.18

require (
github.com/aws/aws-sdk-go v1.42.33
Expand Down
610 changes: 0 additions & 610 deletions cmd/kms-server/go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module github.com/trustbloc/kms

go 1.17
go 1.18

require (
github.com/aws/aws-sdk-go v1.42.33
Expand Down
383 changes: 0 additions & 383 deletions go.sum

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pkg/aws/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,31 +325,31 @@ func (m *mockAWSClient) Sign(input *kms.SignInput) (*kms.SignOutput, error) {
return m.signFunc(input)
}

return nil, nil
return nil, nil //nolint:nilnil
}

func (m *mockAWSClient) GetPublicKey(input *kms.GetPublicKeyInput) (*kms.GetPublicKeyOutput, error) {
if m.getPublicKeyFunc != nil {
return m.getPublicKeyFunc(input)
}

return nil, nil
return nil, nil //nolint:nilnil
}

func (m *mockAWSClient) Verify(input *kms.VerifyInput) (*kms.VerifyOutput, error) {
if m.verifyFunc != nil {
return m.verifyFunc(input)
}

return nil, nil
return nil, nil //nolint:nilnil
}

func (m *mockAWSClient) DescribeKey(input *kms.DescribeKeyInput) (*kms.DescribeKeyOutput, error) {
if m.describeKeyFunc != nil {
return m.describeKeyFunc(input)
}

return nil, nil
return nil, nil //nolint:nilnil
}

func (m *mockAWSClient) CreateKeyRequest(input *kms.CreateKeyInput) (req *request.Request,
Expand Down
12 changes: 6 additions & 6 deletions pkg/controller/mw/authmw/gnapmw/gnap_middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestAccept(t *testing.T) {
mw := gnapmw.Middleware{}

for _, tt := range tests {
req, err := http.NewRequestWithContext(context.Background(), "", "", nil)
req, err := http.NewRequestWithContext(context.Background(), "", "", http.NoBody)
require.NoError(t, err)

for _, header := range tt.headers {
Expand Down Expand Up @@ -155,7 +155,7 @@ func TestMiddleware(t *testing.T) {
next := NewMockHTTPHandler(ctrl)
next.EXPECT().ServeHTTP(gomock.Any(), gomock.Any()).Times(1)

req, err := http.NewRequestWithContext(context.Background(), "", "", nil)
req, err := http.NewRequestWithContext(context.Background(), "", "", http.NoBody)
require.NoError(t, err)

req.Header.Add("Authorization", "GNAP token")
Expand Down Expand Up @@ -205,7 +205,7 @@ func TestMiddleware(t *testing.T) {
next := NewMockHTTPHandler(ctrl)
next.EXPECT().ServeHTTP(gomock.Any(), gomock.Any()).Times(0)

req, err := http.NewRequestWithContext(context.Background(), "", "", nil)
req, err := http.NewRequestWithContext(context.Background(), "", "", http.NoBody)
require.NoError(t, err)

req.Header.Add("Authorization", "GNAP token")
Expand Down Expand Up @@ -234,7 +234,7 @@ func TestMiddleware(t *testing.T) {
next := NewMockHTTPHandler(ctrl)
next.EXPECT().ServeHTTP(gomock.Any(), gomock.Any()).Times(0)

req, err := http.NewRequestWithContext(context.Background(), "", "", nil)
req, err := http.NewRequestWithContext(context.Background(), "", "", http.NoBody)
require.NoError(t, err)

req.Header.Add("Authorization", "Bearer token")
Expand Down Expand Up @@ -263,7 +263,7 @@ func TestMiddleware(t *testing.T) {
next := NewMockHTTPHandler(ctrl)
next.EXPECT().ServeHTTP(gomock.Any(), gomock.Any()).Times(0)

req, err := http.NewRequestWithContext(context.Background(), "", "", nil)
req, err := http.NewRequestWithContext(context.Background(), "", "", http.NoBody)
require.NoError(t, err)

req.Header.Add("Authorization", "GNAP token")
Expand Down Expand Up @@ -292,7 +292,7 @@ func TestMiddleware(t *testing.T) {
next := NewMockHTTPHandler(ctrl)
next.EXPECT().ServeHTTP(gomock.Any(), gomock.Any()).Times(0)

req, err := http.NewRequestWithContext(context.Background(), "", "", nil)
req, err := http.NewRequestWithContext(context.Background(), "", "", http.NoBody)
require.NoError(t, err)

req.Header.Add("Authorization", "GNAP token")
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/mw/authmw/oauthmw/oauth_middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestAccept(t *testing.T) {
mw := oauthmw.Middleware{}

for _, tt := range tests {
req, err := http.NewRequestWithContext(context.Background(), "", "", nil)
req, err := http.NewRequestWithContext(context.Background(), "", "", http.NoBody)
require.NoError(t, err)

for _, header := range tt.headers {
Expand All @@ -70,7 +70,7 @@ func TestMiddleware(t *testing.T) {
next := NewMockHTTPHandler(ctrl)
next.EXPECT().ServeHTTP(gomock.Any(), gomock.Any()).Times(1)

req, err := http.NewRequestWithContext(context.Background(), "", "", nil)
req, err := http.NewRequestWithContext(context.Background(), "", "", http.NoBody)
require.NoError(t, err)

rr := httptest.NewRecorder()
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/mw/authmw/wrap_auth_middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestWrapMiddleware(t *testing.T) {

auth := authmw.Wrap()(next)

req, err := http.NewRequestWithContext(context.Background(), "", "", nil)
req, err := http.NewRequestWithContext(context.Background(), "", "", http.NoBody)
require.NoError(t, err)

rr := httptest.NewRecorder()
Expand All @@ -51,7 +51,7 @@ func TestWrapMiddleware(t *testing.T) {

auth := authmw.Wrap(mw)(next)

req, err := http.NewRequestWithContext(context.Background(), "", "", nil)
req, err := http.NewRequestWithContext(context.Background(), "", "", http.NoBody)
require.NoError(t, err)

rr := httptest.NewRecorder()
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/mw/authmw/zcapmw/zcap_middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestMiddleware(t *testing.T) {
server := httptest.NewServer(mw)
defer server.Close()

req, err := http.NewRequest(http.MethodPost, server.URL+rest.KeyPath, nil) // nolint:noctx // ignore
req, err := http.NewRequest(http.MethodPost, server.URL+rest.KeyPath, http.NoBody) // nolint:noctx // ignore
require.NoError(t, err)

response, err := http.DefaultClient.Do(req) // nolint:bodyclose // ignore
Expand Down Expand Up @@ -77,7 +77,7 @@ func TestMiddleware(t *testing.T) {
config := newConfig()
mwFactory := Middleware{Config: config, Action: "createKey"}

req, err := http.NewRequestWithContext(context.Background(), "", "", nil)
req, err := http.NewRequestWithContext(context.Background(), "", "", http.NoBody)
require.NoError(t, err)

req.Header.Add("Capability-Invocation", "zcap")
Expand Down
2 changes: 1 addition & 1 deletion pkg/shamir/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func CreateProvider(c *ProviderConfig) Provider {
func (p *provider) FetchSecretShare(subject string) ([]byte, error) {
uri := fmt.Sprintf("%s/secret?sub=%s", p.authServerURL, url.QueryEscape(subject))

req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, uri, nil)
req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, uri, http.NoBody)
if err != nil {
return nil, fmt.Errorf("new request: %w", err)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/shamir/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"encoding/base64"
"encoding/json"
"errors"
"io/ioutil"
"io"
"net/http"
"testing"

Expand All @@ -33,7 +33,7 @@ func TestProvider_FetchSecretShare_Success(t *testing.T) {

resp := &http.Response{
StatusCode: http.StatusOK,
Body: ioutil.NopCloser(bytes.NewBuffer(b)),
Body: io.NopCloser(bytes.NewBuffer(b)),
}

client := NewMockHTTPClient(ctrl)
Expand Down Expand Up @@ -64,7 +64,7 @@ func TestProvider_FetchSecretShare_Failed(t *testing.T) {

resp := &http.Response{
StatusCode: http.StatusBadRequest,
Body: ioutil.NopCloser(bytes.NewBuffer(b)),
Body: io.NopCloser(bytes.NewBuffer(b)),
}

client := NewMockHTTPClient(ctrl)
Expand Down
3 changes: 1 addition & 2 deletions pkg/zcapld/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ func (s *Service) SignHeader(req *http.Request, capabilityBytes []byte) (*http.H
}

req.Header.Set(zcapld.CapabilityInvocationHTTPHeader,
fmt.Sprintf(`zcap capability="%s",action="%s"`,
base64.URLEncoding.EncodeToString(compressedZcap), action))
fmt.Sprintf("zcap capability=%q,action=%q", base64.URLEncoding.EncodeToString(compressedZcap), action))

hs := httpsignatures.NewHTTPSignatures(&zcapld.AriesDIDKeySecrets{})
hs.SetSignatureHashAlgorithm(&zcapld.AriesDIDKeySignatureHashAlgorithm{
Expand Down
2 changes: 1 addition & 1 deletion test/bdd/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module github.com/trustbloc/kms/test/bdd

go 1.17
go 1.18

require (
github.com/coreos/go-oidc/v3 v3.1.0
Expand Down
Loading

0 comments on commit 3a2f412

Please sign in to comment.