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

feat: test with Go 1.21 #319

Merged
merged 2 commits into from
Sep 15, 2023
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/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.19", "1.20"]
go-version: ["1.19", "1.20", "1.21"]
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and must be specified without patch version
version: v1.53.2
version: v1.54.2

# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test:golangci-lint:

test:tests:
stage: test
image: golang:1.20
image: golang:1.21
script:
- go test -v -race ./...
except:
Expand Down
3 changes: 3 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,6 @@ issues:
linters:
- gosec
- errcheck
- path: hcloud/error.go
# False-positive in error codes
text: "G101: Potential hardcoded credentials" # gosec
4 changes: 4 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module github.com/hetznercloud/hcloud-go/v2

// This is being kept at a lower value on purpose as raising this would require
// all dependends to update to the new version.
// As long as we do not depend on any newer language feature this can be kept at the current value.
// It should never be higher than the lowest currently supported version of Go.
go 1.19

require (
Expand Down
2 changes: 1 addition & 1 deletion hcloud/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ func loadBalancerCreateOptsToSchema(opts LoadBalancerCreateOpts) schema.LoadBala
TLS: service.HealthCheck.HTTP.TLS,
}
if service.HealthCheck.HTTP.StatusCodes != nil {
schemaHealthCheckHTTP.StatusCodes = &service.HealthCheck.HTTP.StatusCodes
schemaHealthCheckHTTP.StatusCodes = &service.HealthCheck.HTTP.StatusCodes //nolint:gosec // does not result in bug
}
schemaHealthCheck.HTTP = schemaHealthCheckHTTP
}
Expand Down
52 changes: 52 additions & 0 deletions hcloud/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2403,6 +2403,32 @@ func TestLoadBalancerCreateOptsToSchema(t *testing.T) {
},
},
},
{
Protocol: LoadBalancerServiceProtocolHTTP,
DestinationPort: Ptr(443),
Proxyprotocol: Ptr(true),
HTTP: &LoadBalancerCreateOptsServiceHTTP{
CookieName: Ptr("keks"),
CookieLifetime: Ptr(5 * time.Minute),
RedirectHTTP: Ptr(true),
StickySessions: Ptr(true),
Certificates: []*Certificate{{ID: 1}, {ID: 2}},
},
HealthCheck: &LoadBalancerCreateOptsServiceHealthCheck{
Protocol: LoadBalancerServiceProtocolHTTP,
Port: Ptr(443),
Interval: Ptr(5 * time.Second),
Timeout: Ptr(1 * time.Second),
Retries: Ptr(3),
HTTP: &LoadBalancerCreateOptsServiceHealthCheckHTTP{
Domain: Ptr("example.com"),
Path: Ptr("/health"),
Response: Ptr("ok"),
StatusCodes: []string{"4??", "5??"},
TLS: Ptr(true),
},
},
},
},
Targets: []LoadBalancerCreateOptsTarget{
{
Expand Down Expand Up @@ -2457,6 +2483,32 @@ func TestLoadBalancerCreateOptsToSchema(t *testing.T) {
},
},
},
{
Protocol: string(LoadBalancerServiceProtocolHTTP),
DestinationPort: Ptr(443),
Proxyprotocol: Ptr(true),
HTTP: &schema.LoadBalancerCreateRequestServiceHTTP{
CookieName: Ptr("keks"),
CookieLifetime: Ptr(5 * 60),
RedirectHTTP: Ptr(true),
StickySessions: Ptr(true),
Certificates: Ptr([]int64{1, 2}),
},
HealthCheck: &schema.LoadBalancerCreateRequestServiceHealthCheck{
Protocol: string(LoadBalancerServiceProtocolHTTP),
Port: Ptr(443),
Interval: Ptr(5),
Timeout: Ptr(1),
Retries: Ptr(3),
HTTP: &schema.LoadBalancerCreateRequestServiceHealthCheckHTTP{
Domain: Ptr("example.com"),
Path: Ptr("/health"),
Response: Ptr("ok"),
StatusCodes: Ptr([]string{"4??", "5??"}),
TLS: Ptr(true),
},
},
},
},
Targets: []schema.LoadBalancerCreateRequestTarget{
{
Expand Down
Loading