Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade to go 1.22 #3080

Merged
merged 2 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/go-lint/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-buster
FROM golang:1.22-alpine

LABEL author="Everton Haise Taques<[email protected]>"
LABEL maintainer="netboxlabs"
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/go-report/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine
FROM golang:1.22-alpine

LABEL author="Everton Haise Taques<[email protected]>"
LABEL maintainer="netboxlabs"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: '1.22'

- name: Get branch name
shell: bash
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/go-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: '1.22'

- name: Go unit tests
if: ${{ needs.prebuild.outputs.agent == 'true' || github.event_name != 'pull_request' }}
Expand Down Expand Up @@ -155,7 +155,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: '1.22'

- name: Go unit tests
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
Expand Down Expand Up @@ -194,7 +194,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: '1.22'

- name: Go unit tests
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
Expand Down Expand Up @@ -233,7 +233,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: '1.22'

- name: Go unit tests
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
Expand Down Expand Up @@ -272,7 +272,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: '1.22'

- name: Go unit tests
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
Expand Down Expand Up @@ -311,7 +311,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: '1.22'

- name: Go unit tests
if: ${{ needs.prebuild.outputs.orb == 'true' || github.event_name != 'pull_request' }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/go-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: '1.22'

- name: Go unit tests
run: SERVICE=agent make test_service
Expand All @@ -83,7 +83,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: '1.22'

- name: Go unit tests
if: ${{ needs.prebuild.outputs.orb == 'true' }}
Expand All @@ -97,7 +97,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: '1.22'

- name: Go unit tests
if: ${{ needs.prebuild.outputs.orb == 'true' }}
Expand All @@ -111,7 +111,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: '1.22'

- name: Go unit tests
if: ${{ needs.prebuild.outputs.orb == 'true' }}
Expand All @@ -125,7 +125,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: '1.22'

- name: Go unit tests
if: ${{ needs.prebuild.outputs.orb == 'true' }}
Expand All @@ -139,7 +139,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: '1.22'

- name: Go unit tests
if: ${{ needs.prebuild.outputs.orb == 'true' }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/go-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: '1.22'

- name: Go unit tests
if: ${{ needs.prebuild.outputs.agent == 'true' }}
Expand All @@ -84,7 +84,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: '1.22'

- name: Go unit tests
run: |
Expand All @@ -100,7 +100,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: '1.22'

- name: Go unit tests
if: ${{ needs.prebuild.outputs.orb == 'true' }}
Expand All @@ -114,7 +114,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: '1.22'

- name: Go unit tests
if: ${{ needs.prebuild.outputs.orb == 'true' }}
Expand All @@ -128,7 +128,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: '1.22'

- name: Go unit tests
if: ${{ needs.prebuild.outputs.orb == 'true' }}
Expand All @@ -142,7 +142,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: '1.22'

- name: Go unit tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion agent/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG PKTVISOR_TAG=latest-develop
FROM golang:1.21-alpine AS builder
FROM golang:1.22-alpine AS builder

WORKDIR /go/src/github.com/orbcommunity/orb
COPY go.mod .
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine AS builder
FROM golang:1.22-alpine AS builder
ARG SVC
ARG GOARCH
ARG GOARM
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.debug
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine AS builder
FROM golang:1.22-alpine AS builder
ARG SVC
ARG GOARCH
ARG GOARM
Expand Down
1 change: 0 additions & 1 deletion fleet/api/http/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ func encodeError(_ context.Context, err error, w http.ResponseWriter) {
case errors.Contains(errorVal, errors.ErrUnsupportedContentType):
w.WriteHeader(http.StatusUnsupportedMediaType)


case errors.Contains(errorVal, errors.ErrMalformedEntity):
w.WriteHeader(http.StatusBadRequest)
case errors.Contains(errorVal, errors.ErrNotFound):
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/orb-community/orb

go 1.21
go 1.22

require (
github.com/andybalholm/brotli v1.0.6
Expand Down
2 changes: 1 addition & 1 deletion maestro/kubecontrol/kubecontrol.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (svc *deployService) collectorDeploy(ctx context.Context, operation, ownerI
}

// delete temporary file
os.Remove("/tmp/otel-collector-"+sinkId+".json")
os.Remove("/tmp/otel-collector-" + sinkId + ".json")

// TODO this will be retrieved once we move to K8s SDK
collectorName := fmt.Sprintf("otel-%s", sinkId)
Expand Down
2 changes: 1 addition & 1 deletion maestro/postgres/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func migrateDB(db *sqlx.DB) error {
Migrations: []*migrate.Migration{
{
Id: "1",
Up: []string{
Up: []string{
`CREATE TABLE IF NOT EXISTS deployments (
id UUID NOT NULL DEFAULT gen_random_uuid(),
owner_id VARCHAR(255) NOT NULL,
Expand Down
2 changes: 1 addition & 1 deletion maestro/redis/consumer/sinker.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type sinkerActivityListenerService struct {
}

const (
idleStream = "orb.sink_idle"
idleStream = "orb.sink_idle"
activityStream = "orb.sink_activity"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/errors/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var (

// ErrAuthTypeNotFound indicates that authentication type field was not found on the authentication field
ErrAuthTypeNotFound = New("malformed entity specification: authentication type field is expected on configuration field")

// ErrInvalidAuthType indicates invalid authentication type
ErrInvalidAuthType = New("malformed entity specification. type key on authentication field is invalid")

Expand Down
4 changes: 2 additions & 2 deletions sinker/redis/consumer/sink_key_expire.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (s *sinkerKeyExpirationListener) SubscribeToKeyExpiration(ctx context.Conte
pubsub := s.cacheRedisClient.PSubscribe(ctx, "__keyevent@"+redisDB+"__:expired")
defer func(pubsub *redis.PubSub) {
_ = pubsub.Close()
}(pubsub)
}(pubsub)
for {
select {
case <-ctx.Done():
Expand All @@ -57,7 +57,7 @@ func (s *sinkerKeyExpirationListener) SubscribeToKeyExpiration(ctx context.Conte
// ReceiveMessage to be used to receive the message from the sinker key expiration
func (s *sinkerKeyExpirationListener) ReceiveMessage(ctx context.Context, message string) error {
// goroutine
go func(msg string) {
go func(msg string) {
ownerID := message[15:51]
sinkID := message[52:]
event := producer.SinkIdleEvent{
Expand Down
2 changes: 1 addition & 1 deletion sinks/api/http/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func GetConfigurationAndMetadataFromMeta(backendName string, config types.Metada
}

func GetConfigurationAndMetadataFromYaml(backendName string, config string) (configSvc *sinks.Configuration, exporter types.Metadata, authentication types.Metadata, err error) {

if !backend.HaveBackend(backendName) {
return nil, nil, nil, errors.Wrap(errors.ErrInvalidBackend, errors.New("invalid backend"))
}
Expand Down
5 changes: 2 additions & 3 deletions sinks/api/http/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ func encodeError(_ context.Context, err error, w http.ResponseWriter) {
case errors.Contains(errorVal, errors.ErrUnsupportedContentType):
w.WriteHeader(http.StatusUnsupportedMediaType)


case errors.Contains(errorVal, errors.ErrInvalidEndpoint):
w.WriteHeader(http.StatusBadRequest)
case errors.Contains(errorVal, errors.ErrEndpointNotFound):
Expand All @@ -252,7 +251,7 @@ func encodeError(_ context.Context, err error, w http.ResponseWriter) {
case errors.Contains(errorVal, errors.ErrInvalidPasswordType):
w.WriteHeader(http.StatusBadRequest)
case errors.Contains(errorVal, errors.ErrInvalidAuthType):
w.WriteHeader(http.StatusBadRequest)
w.WriteHeader(http.StatusBadRequest)
case errors.Contains(errorVal, errors.ErrRemoteHostNotFound):
w.WriteHeader(http.StatusBadRequest)
case errors.Contains(errorVal, errors.ErrAuthFieldNotFound):
Expand All @@ -262,7 +261,7 @@ func encodeError(_ context.Context, err error, w http.ResponseWriter) {
case errors.Contains(errorVal, errors.ErrExporterFieldNotFound):
w.WriteHeader(http.StatusBadRequest)
case errors.Contains(errorVal, errors.ErrInvalidBackend):
w.WriteHeader(http.StatusBadRequest)
w.WriteHeader(http.StatusBadRequest)
case errors.Contains(errorVal, errors.ErrEntityNameNotFound):
w.WriteHeader(http.StatusBadRequest)
case errors.Contains(errorVal, errors.ErrMalformedEntity):
Expand Down
6 changes: 3 additions & 3 deletions sinks/authentication_type/basicauth/authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ func (a *AuthConfig) ValidateConfiguration(inputFormat string, input interface{}
for key, value := range input.(types.Metadata) {
if _, ok := value.(string); !ok {
if key == "password" {
return errors.Wrap(errors.ErrInvalidPasswordType, errors.New("invalid auth type for field: " + key))
return errors.Wrap(errors.ErrInvalidPasswordType, errors.New("invalid auth type for field: "+key))
}
if key == "type" {
return errors.Wrap(errors.ErrInvalidAuthType, errors.New("invalid auth type for field: " + key))
return errors.Wrap(errors.ErrInvalidAuthType, errors.New("invalid auth type for field: "+key))
}
if key == "username" {
return errors.Wrap(errors.ErrInvalidUsernameType, errors.New("invalid auth type for field: " + key))
return errors.Wrap(errors.ErrInvalidUsernameType, errors.New("invalid auth type for field: "+key))
}
}
vs := value.(string)
Expand Down
Loading