Skip to content
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
14 changes: 7 additions & 7 deletions scripts/check-dex-binary/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ func run(binary, scanner, advisory, web string) error {
if err != nil {
return err
}
defer f.Close()
defer os.Remove(f.Name())
defer func() { _ = f.Close() }()
defer func() { _ = os.Remove(f.Name()) }()
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
cmd := exec.CommandContext(ctx, scanner, "-mode", "binary", "-format", "json", binary)
Expand Down Expand Up @@ -137,7 +137,7 @@ func binaryDigest(path string) ([32]byte, error) {
if err != nil {
return [32]byte{}, err
}
defer f.Close()
defer func() { _ = f.Close() }()
h := sha256.New()
if _, err := io.Copy(h, f); err != nil {
return [32]byte{}, err
Expand Down Expand Up @@ -250,7 +250,7 @@ func nativeTLSFloor(binary, web, floor string) (resultErr error) {
return err
}
defer func() {
if resultErr != nil && resultErr.Error() != "Dex discarded its configured TLS floor" {
if resultErr != nil && resultErr.Error() != "dex discarded its configured TLS floor" {
// This process only receives the fictional configuration below. Keep
// bounded failure diagnostics useful without retaining its private key.
if body, err := os.ReadFile(filepath.Join(fixture, "dex.log")); err == nil {
Expand Down Expand Up @@ -335,7 +335,7 @@ frontend:
if err != nil {
return err
}
defer log.Close()
defer func() { _ = log.Close() }()
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
cmd := exec.CommandContext(ctx, binary, "serve", configPath)
Expand Down Expand Up @@ -377,7 +377,7 @@ frontend:
Issuer string `json:"issuer"`
}
err = json.NewDecoder(io.LimitReader(resp.Body, 65536)).Decode(&document)
resp.Body.Close()
_ = resp.Body.Close()
if err == nil && resp.StatusCode == 200 && document.Issuer == issuer {
ready = true
break
Expand Down Expand Up @@ -489,7 +489,7 @@ func exerciseTLS(address string, good *tls.Config) error {
low := good.Clone()
low.MinVersion, low.MaxVersion = tls.VersionTLS12, tls.VersionTLS12
if err := dial(low); err == nil || !strings.Contains(err.Error(), "protocol version not supported") {
return errors.New("Dex discarded its configured TLS floor")
return errors.New("dex discarded its configured TLS floor")
}
wrongCA := good.Clone()
wrongCA.RootCAs = x509.NewCertPool()
Expand Down
6 changes: 3 additions & 3 deletions scripts/check-dex-binary/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestNativeEndpointsStayReservedUntilHandoff(t *testing.T) {
}
defer func() {
for _, listener := range listeners {
listener.Close()
_ = listener.Close()
}
}()
if len(listeners) != 2 || listeners[0].Addr().String() == listeners[1].Addr().String() {
Expand All @@ -23,7 +23,7 @@ func TestNativeEndpointsStayReservedUntilHandoff(t *testing.T) {
for _, listener := range listeners {
other, err := net.Listen("tcp", listener.Addr().String())
if err == nil {
other.Close()
_ = other.Close()
t.Fatal("endpoint released before native process handoff")
}
}
Expand All @@ -34,7 +34,7 @@ func TestNativeTLSFloorControls(t *testing.T) {
if binary == "" || web == "" {
t.Skip("native release fixture runs in the Dex image workflow")
}
if err := nativeTLSFloor(binary, web, "1.2"); err == nil || err.Error() != "Dex discarded its configured TLS floor" {
if err := nativeTLSFloor(binary, web, "1.2"); err == nil || err.Error() != "dex discarded its configured TLS floor" {
t.Fatalf("weak-floor control must reach the actual protocol check, got %v", err)
}
if err := nativeTLSFloor(binary, web, "1.3"); err != nil {
Expand Down
Loading