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
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ issues:
- path: provider/provider.go # integrations/terraform
linters: [staticcheck]
text: "grpc.WithReturnConnectionError is deprecated"
- linters: [govet]
text: "non-constant format string in call to github.com/gravitational/trace."
exclude-use-default: true
max-same-issues: 0
max-issues-per-linter: 0
Expand Down
2 changes: 1 addition & 1 deletion api/types/matchers_aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (m *AWSMatcher) CheckAndSetDefaults() error {
}
}

if m.Tags == nil || len(m.Tags) == 0 {
if len(m.Tags) == 0 {
m.Tags = map[string]apiutils.Strings{Wildcard: {Wildcard}}
}

Expand Down
2 changes: 1 addition & 1 deletion build.assets/versions.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Sync with devbox.json.
GOLANG_VERSION ?= go1.22.6
GOLANGCI_LINT_VERSION ?= v1.59.1
GOLANGCI_LINT_VERSION ?= v1.60.1

NODE_VERSION ?= 20.14.0

Expand Down
2 changes: 1 addition & 1 deletion integrations/operator/crdgen/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func propertyTable(currentFieldName string, props *apiextv1.JSONSchemaProps) ([]
switch v.Type {
case "object":
fieldType = "object"
if v.Properties == nil || len(v.Properties) == 0 {
if len(v.Properties) == 0 {
break
}

Expand Down
2 changes: 1 addition & 1 deletion lib/auth/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ func (c *githubAPIClient) getTeams(ctx context.Context) ([]teamResponse, error)
"hit maximum number pages that can be fetched from GitHub."

// Print warning to Teleport logs as well as the Audit Log.
log.Warnf(warningMessage)
log.Warn(warningMessage)
if err := c.authServer.emitter.EmitAuditEvent(c.authServer.closeCtx, &apievents.UserLogin{
Metadata: apievents.Metadata{
Type: events.UserLoginEvent,
Expand Down
6 changes: 3 additions & 3 deletions lib/client/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ func (ns *NodeSession) watchSignals(shell io.Writer) {
case <-ctrlCSignal:
_, err := shell.Write([]byte{ctrlCharC})
if err != nil {
log.Errorf(err.Error())
log.Error(err.Error())
}
case <-ns.closer.C:
return
Expand All @@ -663,7 +663,7 @@ func (ns *NodeSession) watchSignals(shell io.Writer) {
if _, ok := event.(terminal.StopEvent); ok {
_, err := shell.Write([]byte{ctrlCharZ})
if err != nil {
log.Errorf(err.Error())
log.Error(err.Error())
}
}
}
Expand Down Expand Up @@ -736,7 +736,7 @@ func (ns *NodeSession) pipeInOut(ctx context.Context, shell io.ReadWriteCloser,
defer ns.closer.Close()
_, err := io.Copy(ns.terminal.Stdout(), shell)
if err != nil {
log.Errorf(err.Error())
log.Error(err.Error())
}
}()

Expand Down
2 changes: 1 addition & 1 deletion lib/config/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ func applyProxyConfig(fc *FileConfig, cfg *servicecfg.Config) error {
warningMessage := "Starting Teleport with a self-signed TLS certificate, this is " +
"not safe for production clusters. Using a self-signed certificate opens " +
"Teleport users to Man-in-the-Middle attacks."
log.Warnf(warningMessage)
log.Warn(warningMessage)
} else {
if err := utils.VerifyCertificateChain(certificateChain); err != nil {
return trace.BadParameter("unable to verify HTTPS certificate chain in %v:\n\n %s\n\n %s",
Expand Down
2 changes: 1 addition & 1 deletion lib/config/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ proxy_service:
}

for _, tt := range tests {
comment := fmt.Sprintf(tt.desc)
comment := tt.desc

_, err := ReadConfig(bytes.NewBufferString(tt.inConfig))
if tt.outError {
Expand Down
2 changes: 1 addition & 1 deletion lib/events/emitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func (l *LoggingEmitter) EmitAuditEvent(ctx context.Context, event apievents.Aud
}
fields[teleport.ComponentKey] = teleport.Component(teleport.ComponentAuditLog)

log.WithFields(fields).Infof(event.GetType())
log.WithFields(fields).Info(event.GetType())
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions lib/joinserver/joinserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package joinserver

import (
"context"
"fmt"
"errors"
"net"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -398,7 +398,7 @@ func TestJoinServiceGRPCServer_RegisterUsingTPMMethod(t *testing.T) {
testPack.mockAuthServer.sendChallenge = tc.challenge
testPack.mockAuthServer.returnCerts = tc.certs
if tc.authErr != "" {
testPack.mockAuthServer.returnError = fmt.Errorf(tc.authErr)
testPack.mockAuthServer.returnError = errors.New(tc.authErr)
}
challengeResponder := func(
challenge *proto.TPMEncryptedCredential,
Expand Down
2 changes: 1 addition & 1 deletion lib/kube/proxy/sess.go
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ func (s *session) join(p *party, emitJoinEvent bool) error {
}
}()
} else if len(s.parties) == 1 {
base := "Waiting for required participants..."
const base = "Waiting for required participants..."

if s.displayParticipantRequirements {
s.BroadcastMessage(base+"\r\n%v", s.accessEvaluator.PrettyRequirementsList())
Expand Down
12 changes: 6 additions & 6 deletions lib/multiplexer/multiplexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func TestMux(t *testing.T) {
Listener: mux.TLS(),
Config: &http.Server{
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, r.RemoteAddr)
fmt.Fprint(w, r.RemoteAddr)
}),
},
}
Expand Down Expand Up @@ -266,7 +266,7 @@ func TestMux(t *testing.T) {
Listener: mux.TLS(),
Config: &http.Server{
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, r.RemoteAddr)
fmt.Fprint(w, r.RemoteAddr)
}),
},
}
Expand Down Expand Up @@ -319,7 +319,7 @@ func TestMux(t *testing.T) {
Listener: mux.TLS(),
Config: &http.Server{
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, r.RemoteAddr)
fmt.Fprint(w, r.RemoteAddr)
}),
},
}
Expand Down Expand Up @@ -362,7 +362,7 @@ func TestMux(t *testing.T) {
Listener: mux.TLS(),
Config: &http.Server{
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, r.RemoteAddr)
fmt.Fprint(w, r.RemoteAddr)
}),
},
}
Expand Down Expand Up @@ -412,7 +412,7 @@ func TestMux(t *testing.T) {
Listener: mux.TLS(),
Config: &http.Server{
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, r.RemoteAddr)
fmt.Fprint(w, r.RemoteAddr)
}),
},
}
Expand Down Expand Up @@ -851,7 +851,7 @@ func TestMux(t *testing.T) {

Config: &http.Server{
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, r.RemoteAddr)
fmt.Fprint(w, r.RemoteAddr)
}),
},
}
Expand Down
2 changes: 1 addition & 1 deletion lib/srv/db/access_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2619,7 +2619,7 @@ func TestAccessClickHouse(t *testing.T) {
for _, test := range tests {
for _, protocol := range []string{defaults.ProtocolClickHouse, defaults.ProtocolClickHouseHTTP} {
t.Run(protocol, func(t *testing.T) {
t.Run(fmt.Sprintf(test.desc), func(t *testing.T) {
t.Run(test.desc, func(t *testing.T) {
// Create user/role with the requested permissions.
testCtx.createUserAndRole(ctx, t, aliceUser, adminRole, test.allowDbUsers, []string{types.Wildcard})

Expand Down
3 changes: 1 addition & 2 deletions lib/srv/db/clickhouse/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"context"
"crypto/tls"
"database/sql"
"fmt"
"io"
"net"
"net/http"
Expand Down Expand Up @@ -251,7 +250,7 @@ func MakeNativeTestClient(ctx context.Context, config common.TestClientConfig) (
func MakeDBTestClient(ctx context.Context, config common.TestClientConfig) (*sql.DB, error) {
conn := clickhouse.OpenDB(&clickhouse.Options{
Protocol: toClickhouseProtocol(config.RouteToDatabase.Protocol),
Addr: []string{fmt.Sprintf(config.Address)},
Addr: []string{config.Address},
})
if err := conn.Ping(); err != nil {
conn.Close()
Expand Down
5 changes: 3 additions & 2 deletions lib/srv/discovery/access_graph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package discovery

import (
"context"
"errors"
"fmt"
"testing"

Expand Down Expand Up @@ -74,7 +75,7 @@ func TestServer_updateDiscoveryConfigStatus(t *testing.T) {
discoveryConfigName: "test",
},
},
pushErr: fmt.Errorf(testErr),
pushErr: errors.New(testErr),
},
want: map[string][]discoveryconfig.Status{
"test": {
Expand All @@ -94,7 +95,7 @@ func TestServer_updateDiscoveryConfigStatus(t *testing.T) {
&fakeFetcher{
count: 1,
discoveryConfigName: "test",
err: fmt.Errorf(testErr),
err: errors.New(testErr),
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions lib/sshutils/scp/scp.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func (cmd *command) sendFile(r *reader, ch io.ReadWriter, fileInfo FileInfo) err
// report progress:
if cmd.ProgressWriter != nil {
statusMessage := fmt.Sprintf("-> %s (%d)", fileInfo.GetPath(), fileInfo.GetSize())
defer fmt.Fprintf(cmd.ProgressWriter, utils.EscapeControl(statusMessage)+"\n")
defer fmt.Fprint(cmd.ProgressWriter, utils.EscapeControl(statusMessage)+"\n")
}
if err := sendOK(ch); err != nil {
return trace.Wrap(err)
Expand Down Expand Up @@ -504,7 +504,7 @@ func (cmd *command) receiveFile(st *state, fc newFileCmd, ch io.ReadWriter) erro
// report progress:
if cmd.ProgressWriter != nil {
statusMessage := fmt.Sprintf("<- %s (%d)", path, fc.Length)
defer fmt.Fprintf(cmd.ProgressWriter, utils.EscapeControl(statusMessage)+"\n")
defer fmt.Fprint(cmd.ProgressWriter, utils.EscapeControl(statusMessage)+"\n")
}

if err = sendOK(ch); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion lib/versioncontrol/github/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func TestCachedReleases(t *testing.T) {
var sec int
for iter.Next() {
ct++
require.NotZero(t, len(iter.Page()), tt.desc)
require.NotEmpty(t, iter.Page(), tt.desc)
for _, target := range iter.Page() {
if target.SecurityPatch() {
sec++
Expand Down
2 changes: 1 addition & 1 deletion tool/tctl/common/resource_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ version: v2`,
buf, err := runResourceCommand(t, clt, []string{"get", "cap", "--format=json"})
require.NoError(t, err)
authPreferences := mustDecodeJSON[[]types.AuthPreferenceV2](t, buf)
require.NotZero(t, len(authPreferences))
require.NotEmpty(t, authPreferences)
tt.expectSecondFactor(t, authPreferences[0].Spec.SecondFactor)
}
})
Expand Down