diff --git a/gitaly_test.go b/gitaly_test.go index 4a45e4331231af1b646c6c69c27c71f116f13b70..2c5e2504dbf290d94ca25d60a8d5ac2ef069a13c 100644 --- a/gitaly_test.go +++ b/gitaly_test.go @@ -633,7 +633,7 @@ func TestGetSnapshotProxiedToGitalyInterruptedStream(t *testing.T) { func buildGetSnapshotParams(gitalyAddress string, repo *pb.Repository) string { msg := serializedMessage("GetSnapshotRequest", &pb.GetSnapshotRequest{Repository: repo}) - return buildGitalyRpcParams(gitalyAddress, msg) + return buildGitalyRPCParams(gitalyAddress, msg) } type rpcArg struct { @@ -645,7 +645,7 @@ type rpcArg struct { // the RPC arguments (which are protobuf messages) in HTTP response headers. // The messages are encoded to JSON objects using pbjson, The strings are then // re-encoded to JSON strings using json. We must replicate this behaviour here -func buildGitalyRpcParams(gitalyAddress string, rpcArgs ...rpcArg) string { +func buildGitalyRPCParams(gitalyAddress string, rpcArgs ...rpcArg) string { built := map[string]interface{}{ "GitalyServer": map[string]string{ "Address": gitalyAddress, diff --git a/logging.go b/logging.go index 8f40f1f624aec79213d75fe1858956f82b5ed200..feaf9ca48d56c869b6d67d260176a8c6b1fc352a 100644 --- a/logging.go +++ b/logging.go @@ -14,7 +14,7 @@ import ( ) func reopenLogWriter(l reopen.WriteCloser, sighup chan os.Signal) { - for _ = range sighup { + for range sighup { log.Print("Reopening log file") l.Reopen() } diff --git a/main.go b/main.go index 48de6c6cebc761dc0a1501b1a6d5a9d63dff997c..fb69977a2d6878e389b0ff55a8d72427340fa2f8 100644 --- a/main.go +++ b/main.go @@ -34,7 +34,7 @@ import ( "github.com/prometheus/client_golang/prometheus/promhttp" ) -// Current version of GitLab Workhorse +// Version is the current version of GitLab Workhorse var Version = "(unknown version)" // Set at build time in the Makefile var printVersion = flag.Bool("version", false, "Print version and exit") diff --git a/main_test.go b/main_test.go index 63e8330663b897d61b1d11f2ef7a353ffdfa8e1a..861054916ecf8551ab81620b4a6ce6447494c1f4 100644 --- a/main_test.go +++ b/main_test.go @@ -460,9 +460,9 @@ func TestSendURLForArtifacts(t *testing.T) { } func TestGetGitBlob(t *testing.T) { - blobId := "50b27c6518be44c42c4d87966ae2481ce895624c" // the LICENSE file in the test repository + blobID := "50b27c6518be44c42c4d87966ae2481ce895624c" // the LICENSE file in the test repository blobLength := 1075 - jsonParams := fmt.Sprintf(`{"RepoPath":"%s","BlobId":"%s"}`, path.Join(testRepoRoot, testRepo), blobId) + jsonParams := fmt.Sprintf(`{"RepoPath":"%s","BlobId":"%s"}`, path.Join(testRepoRoot, testRepo), blobID) expectedBody := "The MIT License (MIT)" resp, body, err := doSendDataRequest("/something", "git-blob", jsonParams) @@ -582,8 +582,8 @@ func setupStaticFile(fpath, content string) error { if err := os.MkdirAll(path.Join(*documentRoot, path.Dir(fpath)), 0755); err != nil { return err } - static_file := path.Join(*documentRoot, fpath) - if err := ioutil.WriteFile(static_file, []byte(content), 0666); err != nil { + staticFile := path.Join(*documentRoot, fpath) + if err := ioutil.WriteFile(staticFile, []byte(content), 0666); err != nil { return err } return nil @@ -638,7 +638,7 @@ func archiveOKServer(t *testing.T, archiveName string) *httptest.Server { archivePath := path.Join(cwd, cacheDir, archiveName) - params := struct{ RepoPath, ArchivePath, CommitId, ArchivePrefix string }{ + params := struct{ RepoPath, ArchivePath, CommitID, ArchivePrefix string }{ repoPath(t), archivePath, "c7fbe50c7c7419d9701eebe64b1fdacc3df5b9dd", diff --git a/upload_test.go b/upload_test.go index c5a64d273c1799c4df6de3d8d9b287d863814c8b..5823e8653aa85e57dcdd9fa0c730130afe4f2ec4 100644 --- a/upload_test.go +++ b/upload_test.go @@ -21,18 +21,18 @@ import ( "github.com/stretchr/testify/require" ) -type uploadArtifactsFunction func(url, contentType string, body io.Reader) (*http.Response, error, string) +type uploadArtifactsFunction func(url, contentType string, body io.Reader) (*http.Response, string, error) -func uploadArtifactsV1(url, contentType string, body io.Reader) (*http.Response, error, string) { +func uploadArtifactsV1(url, contentType string, body io.Reader) (*http.Response, string, error) { resource := `/ci/api/v1/builds/123/artifacts` resp, err := http.Post(url+resource, contentType, body) - return resp, err, resource + return resp, resource, err } -func uploadArtifactsV4(url, contentType string, body io.Reader) (*http.Response, error, string) { +func uploadArtifactsV4(url, contentType string, body io.Reader) (*http.Response, string, error) { resource := `/api/v4/jobs/123/artifacts` resp, err := http.Post(url+resource, contentType, body) - return resp, err, resource + return resp, resource, err } func testArtifactsUpload(t *testing.T, uploadArtifacts uploadArtifactsFunction) { @@ -45,7 +45,7 @@ func testArtifactsUpload(t *testing.T, uploadArtifacts uploadArtifactsFunction) ws := startWorkhorseServer(ts.URL) defer ws.Close() - resp, err, resource := uploadArtifacts(ws.URL, contentType, reqBody) + resp, resource, err := uploadArtifacts(ws.URL, contentType, reqBody) assert.NoError(t, err) defer resp.Body.Close()