Updated to Go 1.18 (#1697)

* Updated to Go 1.18

Signed-off-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>

* Added go.work file
With Go 1.18, this allows gopls (the Go language server used for example in VS Code) to work inside test apps too.
See: https://go.dev/doc/tutorial/workspaces

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

* Removed go.work

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

* 💄

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

Co-authored-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
This commit is contained in:
Alessandro (Ale) Segala 2022-05-06 20:44:45 +00:00 committed by GitHub
parent db99b43068
commit e6c67356cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 45 additions and 40 deletions

View File

@ -184,7 +184,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '^1.17'
go-version: '^1.18'
- name: Download Go dependencies
working-directory: ${{ env.TEST_PATH }}
@ -195,7 +195,7 @@ jobs:
- name: Check that go mod tidy is up-to-date
working-directory: ${{ env.TEST_PATH }}
run: |
go mod tidy -compat=1.17
go mod tidy -compat=1.18
git diff --exit-code ./go.mod
git diff --exit-code ./go.sum

View File

@ -29,7 +29,7 @@ jobs:
name: Build ${{ matrix.target_os }}_${{ matrix.target_arch }} binaries
runs-on: ${{ matrix.os }}
env:
GOVER: 1.17
GOVER: 1.18
GOOS: ${{ matrix.target_os }}
GOARCH: ${{ matrix.target_arch }}
GOPROXY: https://proxy.golang.org

View File

@ -316,7 +316,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '^1.17.3'
go-version: '^1.18'
- name: Download Go dependencies
run: |

3
.gitignore vendored
View File

@ -2,5 +2,6 @@
.idea
.vscode
/vendor
.dccache
go.work
.dccache
go.work.sum

View File

@ -79,7 +79,7 @@ MODFILES := $(shell find . -name go.mod)
define modtidy-target
.PHONY: modtidy-$(1)
modtidy-$(1):
cd $(shell dirname $(1)); go mod tidy -compat=1.17; cd -
cd $(shell dirname $(1)); go mod tidy -compat=1.18; cd -
endef
# Generate modtidy target action for each go.mod file

View File

@ -36,7 +36,7 @@ import (
type kubernetesInput struct {
kubeClient kubernetes.Interface
namespace string
resyncPeriodInSec time.Duration // nolint:stylecheck
resyncPeriodInSec time.Duration
logger logger.Logger
}

View File

@ -220,10 +220,15 @@ func (ls *LocalStorage) list(filename string, req *bindings.InvokeRequest) (*bin
}, nil
}
//nolint:staticcheck
func getSecureAbsRelPath(rootPath string, filename string) (absPath string, relPath string, err error) {
absPath, err = securejoin.SecureJoin(rootPath, filename)
if err != nil {
return
}
relPath, err = filepath.Rel(rootPath, absPath)
if err != nil {
return
}
return
}

View File

@ -38,7 +38,6 @@ type mockClient struct {
}
func (mcf mockClientFactory) Get(metadata bindings.Metadata) (zbc.Client, error) {
//nolint:staticcheck
mcf.metadata = metadata
if mcf.error != nil {

View File

@ -61,7 +61,8 @@ func (mc *mockCreateInstanceClient) NewCreateInstanceCommand() commands.CreateIn
return mc.cmd1
}
//nolint // BPMNProcessId comes from the Zeebe client API and cannot be written as BPMNProcessID
// BPMNProcessId comes from the Zeebe client API and cannot be written as BPMNProcessID
// Note that when the `stylecheck` linter is working again, this method will need "nolink:stylecheck" (can't change name to ID or it won't satisfy an interface)
func (cmd1 *mockCreateInstanceCommandStep1) BPMNProcessId(bpmnProcessID string) commands.CreateInstanceCommandStep2 {
cmd1.bpmnProcessID = bpmnProcessID

View File

@ -75,7 +75,8 @@ func (cmd2 *mockPublishMessageCommandStep2) CorrelationKey(correlationKey string
return cmd2.cmd3
}
//nolint // MessageId comes from the Zeebe client API and cannot be written as MessageID
// MessageId comes from the Zeebe client API and cannot be written as MessageID
// Note that when the `stylecheck` linter is working again, this method will need "nolink:stylecheck" (can't change name to ID or it won't satisfy an interface)
func (cmd3 *mockPublishMessageCommandStep3) MessageId(messageID string) commands.PublishMessageCommandStep3 {
cmd3.messageID = messageID

View File

@ -36,7 +36,6 @@ type mockClient struct {
}
func (mcf mockClientFactory) Get(metadata bindings.Metadata) (zbc.Client, error) {
//nolint:staticcheck
mcf.metadata = metadata
if mcf.error != nil {

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/dapr/components-contrib
go 1.17
go 1.18
require (
cloud.google.com/go v0.86.0

View File

@ -92,7 +92,7 @@ func mapClientConfig(config *Config) *consul.Config {
return nil
}
mapBasicAuth := func(config *HttpBasicAuth) *consul.HttpBasicAuth {
mapBasicAuth := func(config *HTTPBasicAuth) *consul.HttpBasicAuth {
if config == nil {
return nil
}
@ -107,7 +107,7 @@ func mapClientConfig(config *Config) *consul.Config {
Address: config.Address,
Scheme: config.Scheme,
Datacenter: config.Datacenter,
HttpAuth: mapBasicAuth(config.HttpAuth),
HttpAuth: mapBasicAuth(config.HTTPAuth),
WaitTime: config.WaitTime,
Token: config.Token,
TokenFile: config.TokenFile,
@ -327,8 +327,7 @@ func mapAdvancedRegistration(config *AgentServiceRegistration) *consul.AgentServ
return mapped
}
//nolint:stylecheck
type HttpBasicAuth struct {
type HTTPBasicAuth struct {
Username string
Password string
}
@ -337,12 +336,11 @@ type Config struct {
Address string
Scheme string
Datacenter string
//nolint:stylecheck
HttpAuth *HttpBasicAuth
WaitTime time.Duration
Token string
TokenFile string
TLSConfig TLSConfig
HTTPAuth *HTTPBasicAuth
WaitTime time.Duration
Token string
TokenFile string
TLSConfig TLSConfig
}
type TLSConfig struct {

View File

@ -815,7 +815,7 @@ func TestMapConfig(t *testing.T) {
Address: "Address",
Scheme: "Scheme",
Datacenter: "Datacenter",
HttpAuth: &HttpBasicAuth{
HTTPAuth: &HTTPBasicAuth{
Username: "Username",
Password: "Password",
},
@ -1132,9 +1132,9 @@ func compareClientConfig(t *testing.T, expected *Config, actual *consul.Config)
assert.Equal(t, expected.Address, actual.Address)
assert.Equal(t, expected.Datacenter, actual.Datacenter)
if expected.HttpAuth != nil {
assert.Equal(t, expected.HttpAuth.Username, actual.HttpAuth.Username)
assert.Equal(t, expected.HttpAuth.Password, actual.HttpAuth.Password)
if expected.HTTPAuth != nil {
assert.Equal(t, expected.HTTPAuth.Username, actual.HttpAuth.Username)
assert.Equal(t, expected.HTTPAuth.Password, actual.HttpAuth.Password)
}
assert.Equal(t, expected.Scheme, actual.Scheme)

View File

@ -501,7 +501,8 @@ func (c *StateStore) checkStoredProcedures() error {
c.logger.Debugf("Cosmos DB stored procedure version: %d", ver)
}
if err != nil || (err == nil && ver != spVersion) {
return fmt.Errorf("Dapr requires stored procedures created in Cosmos DB before it can be used as state store. Those stored procedures are currently not existing or are using a different version than expected. When you authenticate using Azure AD we cannot automatically create them for you: please start this state store with a Cosmos DB master key just once so we can create the stored procedures for you; otherwise, you can check our docs to learn how to create them yourself: https://aka.ms/dapr/cosmosdb-aad") // nolint:stylecheck
// Note that when the `stylecheck` linter is working with Go 1.18 again, this will need "nolint:stylecheck"
return fmt.Errorf("Dapr requires stored procedures created in Cosmos DB before it can be used as state store. Those stored procedures are currently not existing or are using a different version than expected. When you authenticate using Azure AD we cannot automatically create them for you: please start this state store with a Cosmos DB master key just once so we can create the stored procedures for you; otherwise, you can check our docs to learn how to create them yourself: https://aka.ms/dapr/cosmosdb-aad")
}
return nil
}

View File

@ -1,6 +1,6 @@
module github.com/dapr/components-contrib/tests/certification/bindings/azure/blobstorage
go 1.17
go 1.18
require (
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.2.0

View File

@ -1,6 +1,6 @@
module github.com/dapr/components-contrib/tests/certification/bindings/azure/cosmosdb
go 1.17
go 1.18
require (
github.com/a8m/documentdb v1.3.1-0.20220405205223-5b41ba0aaeb1

View File

@ -1,6 +1,6 @@
module servicebusqueue_test
go 1.17
go 1.18
require (
github.com/dapr/components-contrib v1.7.1-0.20220426033643-068938c67654

View File

@ -1,6 +1,6 @@
module github.com/dapr/components-contrib/tests/certification
go 1.17
go 1.18
require (
github.com/cenkalti/backoff v2.2.1+incompatible

View File

@ -1,6 +1,6 @@
module github.com/dapr/components-contrib/tests/certification/pubsub/azure/eventhubs
go 1.17
go 1.18
require (
github.com/dapr/components-contrib v1.7.1-0.20220426033643-068938c67654

View File

@ -1,6 +1,6 @@
module github.com/dapr/components-contrib/tests/certification/pubsub/kafka
go 1.17
go 1.18
require (
github.com/Shopify/sarama v1.23.1

View File

@ -1,6 +1,6 @@
module github.com/dapr/components-contrib/tests/certification/pubsub/mqtt
go 1.17
go 1.18
require (
github.com/cenkalti/backoff v2.2.1+incompatible

View File

@ -1,6 +1,6 @@
module github.com/dapr/components-contrib/tests/certification/pubsub/rabbitmq
go 1.17
go 1.18
require (
github.com/cenkalti/backoff/v4 v4.1.1

View File

@ -1,6 +1,6 @@
module github.com/dapr/components-contrib/tests/certification/secretstores/azure/keyvault
go 1.17
go 1.18
require (
github.com/dapr/components-contrib v1.7.1-0.20220426033643-068938c67654

View File

@ -1,6 +1,6 @@
module github.com/dapr/components-contrib/tests/certification/secretstores/azure/keyvault
go 1.17
go 1.18
require (
github.com/dapr/components-contrib v1.7.1-0.20220426033643-068938c67654

View File

@ -9,7 +9,7 @@ services:
- ./jwt:/jwt
dev:
image: golang:1.17.6
image: golang:1.18
network_mode:
service:nats
volumes:

View File

@ -1,6 +1,6 @@
module github.com/dapr/components-contrib/tests/e2e/pubsub/jetstream
go 1.17
go 1.18
require (
github.com/dapr/components-contrib v1.5.1