upgrade to go v1.24 (#5562)

* upgrade to go v1.24

* add a macOS-specific //nolint comment too

---------

Co-authored-by: Kenneth Jenkins <51246568+kenjenkins@users.noreply.github.com>
This commit is contained in:
Caleb Doxsey 2025-04-02 15:53:09 -06:00 committed by GitHub
parent 8d9f1bb38e
commit c47055bece
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
89 changed files with 170 additions and 190 deletions

View file

@ -90,7 +90,7 @@ func TestAutocertOptions_Validate(t *testing.T) {
}
},
"ok/trusted-ca-file": func(t *testing.T) test {
f, err := os.CreateTemp("", "pomerium-test-ca")
f, err := os.CreateTemp(t.TempDir(), "pomerium-test-ca")
require.NoError(t, err)
n, err := f.Write(certPEM)
require.NoError(t, err)
@ -128,7 +128,7 @@ func TestAutocertOptions_Validate(t *testing.T) {
}
},
"fail/trusted-ca-combined": func(t *testing.T) test {
f, err := os.CreateTemp("", "pomerium-test-ca")
f, err := os.CreateTemp(t.TempDir(), "pomerium-test-ca")
require.NoError(t, err)
n, err := f.Write(certPEM)
require.NoError(t, err)

View file

@ -6,10 +6,11 @@ import (
"encoding/pem"
"testing"
"github.com/pomerium/pomerium/config"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/proto"
"github.com/pomerium/pomerium/config"
)
func TestGenerateCatchAllCertificate(t *testing.T) {

View file

@ -16,12 +16,13 @@ import (
envoy_config_overload_v3 "github.com/envoyproxy/go-control-plane/envoy/config/overload/v3"
envoy_extensions_access_loggers_file_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/file/v3"
envoy_extensions_resource_monitors_downstream_connections_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/resource_monitors/downstream_connections/v3"
"google.golang.org/protobuf/types/known/durationpb"
"google.golang.org/protobuf/types/known/structpb"
"github.com/pomerium/pomerium/config"
"github.com/pomerium/pomerium/config/otelconfig"
"github.com/pomerium/pomerium/internal/telemetry"
"github.com/pomerium/pomerium/pkg/telemetry/trace"
"google.golang.org/protobuf/types/known/durationpb"
"google.golang.org/protobuf/types/known/structpb"
)
const maxActiveDownstreamConnections = 50000

View file

@ -216,7 +216,6 @@ func (b *Builder) buildPolicyEndpoints(
) ([]Endpoint, error) {
var endpoints []Endpoint
for _, dst := range policy.To {
dst := dst
ts, err := b.buildPolicyTransportSocket(ctx, cfg, policy, dst.URL)
if err != nil {
return nil, err

View file

@ -275,7 +275,6 @@ func Test_urlMatchesHost(t *testing.T) {
{"non standard port", "http://example.com:81", "example.com", false},
{"non standard host port", "http://example.com:81", "example.com:80", false},
} {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

View file

@ -13,13 +13,14 @@ import (
metadatav3 "github.com/envoyproxy/go-control-plane/envoy/type/metadata/v3"
envoy_tracing_v3 "github.com/envoyproxy/go-control-plane/envoy/type/tracing/v3"
envoy_type_v3 "github.com/envoyproxy/go-control-plane/envoy/type/v3"
"google.golang.org/protobuf/types/known/durationpb"
"google.golang.org/protobuf/types/known/wrapperspb"
extensions_trace_context "github.com/pomerium/envoy-custom/api/extensions/http/early_header_mutation/trace_context"
extensions_uuidx "github.com/pomerium/envoy-custom/api/extensions/request_id/uuidx"
extensions_pomerium_otel "github.com/pomerium/envoy-custom/api/extensions/tracers/pomerium_otel"
"github.com/pomerium/pomerium/config/otelconfig"
"github.com/pomerium/pomerium/pkg/telemetry/trace"
"google.golang.org/protobuf/types/known/durationpb"
"google.golang.org/protobuf/types/known/wrapperspb"
)
func isTracingEnabled(cfg *otelconfig.Config) bool {

View file

@ -1871,13 +1871,6 @@ func compareByteSliceSlice(a, b [][]byte) int {
}
}
func min(x, y int) int {
if x < y {
return x
}
return y
}
// NewAtomicOptions creates a new AtomicOptions.
func NewAtomicOptions() *atomicutil.Value[*Options] {
return atomicutil.NewValue(new(Options))

View file

@ -331,7 +331,7 @@ func Test_parsePolicyFile(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
tempFile, _ := os.CreateTemp("", "*.json")
tempFile, _ := os.CreateTemp(t.TempDir(), "*.json")
defer tempFile.Close()
defer os.Remove(tempFile.Name())
tempFile.Write(tt.policyBytes)
@ -462,7 +462,7 @@ func TestOptionsFromViper(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
tempFile, _ := os.CreateTemp("", "*.json")
tempFile, _ := os.CreateTemp(t.TempDir(), "*.json")
defer tempFile.Close()
defer os.Remove(tempFile.Name())
tempFile.Write(tt.configBytes)
@ -506,8 +506,7 @@ func Test_NewOptionsFromConfigEnvVar(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
for k, v := range tt.envKeyPairs {
os.Setenv(k, v)
defer os.Unsetenv(k)
t.Setenv(k, v)
}
_, err := newOptionsFromConfig("")
if (err != nil) != tt.wantErr {
@ -578,7 +577,7 @@ func Test_AutoCertOptionsFromEnvVar(t *testing.T) {
"ok/custom-ca-file": func(t *testing.T) test {
certPEM, err := newCACertPEM()
require.NoError(t, err)
f, err := os.CreateTemp("", "pomerium-test-ca")
f, err := os.CreateTemp(t.TempDir(), "pomerium-test-ca")
require.NoError(t, err)
n, err := f.Write(certPEM)
require.NoError(t, err)
@ -617,8 +616,7 @@ func Test_AutoCertOptionsFromEnvVar(t *testing.T) {
tc := run(t)
t.Run(name, func(t *testing.T) {
for k, v := range tc.envs {
os.Setenv(k, v)
defer os.Unsetenv(k)
t.Setenv(k, v)
}
o, err := newOptionsFromConfig("")
if err != nil {
@ -658,7 +656,6 @@ func TestCertificatesArrayParsing(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
@ -827,7 +824,6 @@ func TestOptions_DefaultURL(t *testing.T) {
}
for _, tc := range tests {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
u, err := tc.f()
@ -1235,7 +1231,6 @@ LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1IUUNBUUVFSUdHaDZGbEJlOHl5OWRSSmdtKzM1
0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
}, nil},
} {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
@ -1285,7 +1280,6 @@ func TestOptions_GetCookieSameSite(t *testing.T) {
{"none", http.SameSiteNoneMode},
{"UnKnOwN", http.SameSiteDefaultMode},
} {
tc := tc
t.Run(tc.input, func(t *testing.T) {
t.Parallel()
@ -1314,7 +1308,6 @@ func TestOptions_GetCSRFSameSite(t *testing.T) {
{"UnKnOwN", "", csrf.SameSiteDefaultMode},
{"", apple.Name, csrf.SameSiteNoneMode},
} {
tc := tc
t.Run(tc.cookieSameSite, func(t *testing.T) {
t.Parallel()

View file

@ -176,7 +176,6 @@ func Test_PolicyRouteID(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
assert.NoError(t, tt.basePolicy.Validate())