Skip to content

Commit 6fdab58

Browse files
committed
Lint fixes for shared packages
1 parent cffe8fc commit 6fdab58

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

client/transport.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package client provides an HTTP client with enhanced logging, tracing, and correlation handling.
12
package client
23

34
import (
@@ -13,6 +14,7 @@ type transport struct {
1314
next http.RoundTripper
1415
}
1516

17+
// RoundTrip executes a single HTTP transaction, adding logging and tracing capabilities.
1618
func (rt *transport) RoundTrip(request *http.Request) (*http.Response, error) {
1719
ctx := request.Context()
1820

@@ -55,10 +57,12 @@ func (rt *transport) RoundTrip(request *http.Request) (*http.Response, error) {
5557
return response, nil
5658
}
5759

60+
// DefaultTransport returns a clone of the default HTTP transport.
5861
func DefaultTransport() http.RoundTripper {
5962
return http.DefaultTransport.(*http.Transport).Clone()
6063
}
6164

65+
// NewTransport creates a new transport with logging, tracing, and correlation handling.
6266
func NewTransport(next http.RoundTripper) http.RoundTripper {
6367
t := &transport{next: next}
6468
return correlation.NewInstrumentedRoundTripper(tracing.NewRoundTripper(t))
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
// Package disallowedcommand provides an error for handling disallowed commands.
12
package disallowedcommand
23

34
import "errors"
45

56
var (
6-
Error = errors.New("Disallowed command")
7+
// Error is returned when a disallowed command is encountered.
8+
Error = errors.New("Disallowed command") //nolint:stylecheck // Used to display the error message to the user.
79
)

internal/command/uploadarchive/gitalycall_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ func TestUploadArchive(t *testing.T) {
2121
for _, network := range []string{"unix", "tcp", "dns"} {
2222
t.Run(fmt.Sprintf("via %s network", network), func(t *testing.T) {
2323
gitalyAddress, testServer := testserver.StartGitalyServer(t, network)
24-
t.Log(fmt.Sprintf("Server address: %s", gitalyAddress))
24+
t.Logf("Server address: %s", gitalyAddress)
2525

2626
requests := requesthandlers.BuildAllowedWithGitalyHandlers(t, gitalyAddress)
2727
url := testserver.StartHTTPServer(t, requests)
2828

2929
output := &bytes.Buffer{}
3030
input := &bytes.Buffer{}
3131

32-
userId := "1"
32+
userID := "1"
3333
repo := "group/repo"
3434

3535
env := sshenv.Env{
@@ -39,7 +39,7 @@ func TestUploadArchive(t *testing.T) {
3939
}
4040

4141
args := &commandargs.Shell{
42-
GitlabKeyId: userId,
42+
GitlabKeyId: userID,
4343
CommandType: commandargs.UploadArchive,
4444
SshArgs: []string{"git-upload-archive", repo},
4545
Env: env,

support/lint_last_known_acceptable.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ client/testserver/testserver.go:20:6: exported: exported type TestRequestHandler
3838
client/testserver/testserver.go:46:12: G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server (gosec)
3939
client/testserver/testserver.go:52:17: Error return value of `server.Serve` is not checked (errcheck)
4040
client/testserver/testserver.go:117:18: G304: Potential file inclusion via variable (gosec)
41-
client/transport.go:58:1: exported: exported function DefaultTransport should have comment or be unexported (revive)
42-
client/transport.go:62:1: exported: exported function NewTransport should have comment or be unexported (revive)
4341
cmd/gitlab-shell-authorized-keys-check/main.go:40:14: Error return value of `fmt.Fprintf` is not checked (errcheck)
4442
cmd/gitlab-shell-authorized-keys-check/main.go:43:13: unnecessary conversion (unconvert)
4543
cmd/gitlab-shell-authorized-principals-check/command/command.go:1:1: package-comments: should have a package comment (revive)
@@ -236,10 +234,6 @@ internal/command/shared/customaction/customaction_test.go:115:5: go-require: do
236234
internal/command/shared/customaction/customaction_test.go:117:5: go-require: do not use require in http handlers (testifylint)
237235
internal/command/shared/customaction/customaction_test.go:118:5: go-require: do not use require in http handlers (testifylint)
238236
internal/command/shared/customaction/customaction_test.go:121:5: go-require: do not use require in http handlers (testifylint)
239-
internal/command/shared/disallowedcommand/disallowedcommand.go:1:1: package-comments: should have a package comment (revive)
240-
internal/command/shared/disallowedcommand/disallowedcommand.go:6:2: exported: exported var Error should have comment or be unexported (revive)
241-
internal/command/uploadarchive/gitalycall_test.go:24:4: S1038: should use t.Logf(...) instead of t.Log(fmt.Sprintf(...)) (gosimple)
242-
internal/command/uploadarchive/gitalycall_test.go:32:4: var-naming: var userId should be userID (revive)
243237
internal/config/config.go:1:1: package-comments: should have a package comment (revive)
244238
internal/config/config.go:21:2: G101: Potential hardcoded credentials (gosec)
245239
internal/config/config.go:24:6: exported: exported type YamlDuration should have comment or be unexported (revive)

0 commit comments

Comments
 (0)