Commit d3acd418 authored by Jacob Vosmaer (GitLab)'s avatar Jacob Vosmaer (GitLab)

Merge branch 'fix-golint-warnings' into 'master'

fixes golint warnings

See merge request gitlab-org/gitlab-workhorse!252
parents 4f15bdfa dc94ea82
......@@ -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,
......
......@@ -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()
}
......
......@@ -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")
......
......@@ -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",
......
......@@ -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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment