Skip to content

Commit 9f8bfdb

Browse files
fix: resolve lint issues
1 parent 7cba3f9 commit 9f8bfdb

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

pkg/api/dirs_test.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func TestDirs(t *testing.T) {
4949
jsonhttptest.WithRequestBody(bytes.NewReader(nil)),
5050
jsonhttptest.WithRequestHeader(api.SwarmCollectionHeader, "True"),
5151
jsonhttptest.WithExpectedJSONResponse(jsonhttp.StatusResponse{
52-
Message: api.InvalidRequest.Error(),
52+
Message: api.ErrInvalidRequest.Error(),
5353
Code: http.StatusBadRequest,
5454
}),
5555
jsonhttptest.WithRequestHeader(api.ContentTypeHeader, api.ContentTypeTar),
@@ -66,7 +66,7 @@ func TestDirs(t *testing.T) {
6666
jsonhttptest.WithRequestBody(file),
6767
jsonhttptest.WithRequestHeader(api.SwarmCollectionHeader, "True"),
6868
jsonhttptest.WithExpectedJSONResponse(jsonhttp.StatusResponse{
69-
Message: api.DirectoryStoreError.Error(),
69+
Message: api.ErrDirectoryStoreError.Error(),
7070
Code: http.StatusInternalServerError,
7171
}),
7272
jsonhttptest.WithRequestHeader(api.ContentTypeHeader, api.ContentTypeTar),
@@ -86,7 +86,7 @@ func TestDirs(t *testing.T) {
8686
jsonhttptest.WithRequestBody(tarReader),
8787
jsonhttptest.WithRequestHeader(api.SwarmCollectionHeader, "True"),
8888
jsonhttptest.WithExpectedJSONResponse(jsonhttp.StatusResponse{
89-
Message: api.InvalidContentType.Error(),
89+
Message: api.ErrInvalidContentType.Error(),
9090
Code: http.StatusBadRequest,
9191
}),
9292
jsonhttptest.WithRequestHeader(api.ContentTypeHeader, "other"),
@@ -372,7 +372,6 @@ func TestDirs(t *testing.T) {
372372
// check error document
373373
validateAltPath(t, "_non_existent_file_path_", errorDocumentPath)
374374
}
375-
376375
}
377376
t.Run(tc.name, func(t *testing.T) {
378377
t.Run("tar_upload", func(t *testing.T) {
@@ -520,7 +519,7 @@ func TestDirsEmtpyDir(t *testing.T) {
520519
jsonhttptest.WithRequestHeader(api.SwarmCollectionHeader, "true"),
521520
jsonhttptest.WithRequestHeader(api.ContentTypeHeader, api.ContentTypeTar),
522521
jsonhttptest.WithExpectedJSONResponse(jsonhttp.StatusResponse{
523-
Message: api.EmptyDir.Error(),
522+
Message: api.ErrEmptyDir.Error(),
524523
Code: http.StatusBadRequest,
525524
}),
526525
)
@@ -543,7 +542,7 @@ func tarFiles(t *testing.T, files []f) *bytes.Buffer {
543542
// create tar header and write it
544543
hdr := &tar.Header{
545544
Name: filePath,
546-
Mode: 0600,
545+
Mode: 0o600,
547546
Size: int64(len(file.data)),
548547
}
549548
if err := tw.WriteHeader(hdr); err != nil {
@@ -572,7 +571,7 @@ func tarEmptyDir(t *testing.T) *bytes.Buffer {
572571

573572
hdr := &tar.Header{
574573
Name: "empty/",
575-
Mode: 0600,
574+
Mode: 0o600,
576575
}
577576

578577
if err := tw.WriteHeader(hdr); err != nil {
@@ -605,11 +604,9 @@ func multipartFiles(t *testing.T, files []f) (*bytes.Buffer, string) {
605604
contentType := file.header.Get(api.ContentTypeHeader)
606605
if contentType != "" {
607606
hdr.Set(api.ContentTypeHeader, contentType)
608-
609607
}
610608
if len(file.data) > 0 {
611609
hdr.Set(api.ContentLengthHeader, strconv.Itoa(len(file.data)))
612-
613610
}
614611
part, err := mw.CreatePart(hdr)
615612
if err != nil {

pkg/api/export_test.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@ type (
2121
)
2222

2323
var (
24-
InvalidContentType = errInvalidContentType
25-
InvalidRequest = errInvalidRequest
26-
DirectoryStoreError = errDirectoryStore
27-
EmptyDir = errEmptyDir
24+
ErrInvalidContentType = errInvalidContentType
25+
ErrInvalidRequest = errInvalidRequest
26+
ErrDirectoryStoreError = errDirectoryStore
27+
ErrEmptyDir = errEmptyDir
2828
)
2929

30-
var (
31-
ContentTypeTar = contentTypeTar
32-
)
30+
var ContentTypeTar = contentTypeTar
3331

3432
var (
3533
ErrNoResolver = errNoResolver
@@ -138,6 +136,7 @@ type HexInvalidByteError = hexInvalidByteError
138136
func MapStructure(input, output interface{}, hooks map[string]func(v string) (string, error)) error {
139137
return mapStructure(input, output, hooks)
140138
}
139+
141140
func NewParseError(entry, value string, cause error) error {
142141
return newParseError(entry, value, cause)
143142
}

0 commit comments

Comments
 (0)