diff --git a/Makefile b/Makefile index eeb254ea..581558fe 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ GO ?= go GOLANGCI_LINT ?= $$($(GO) env GOPATH)/bin/golangci-lint -GOLANGCI_LINT_VERSION ?= v1.57.1 +GOLANGCI_LINT_VERSION ?= v1.61.0 GOGOPROTOBUF ?= protoc-gen-gogofaster GOGOPROTOBUF_VERSION ?= v1.3.1 diff --git a/cmd/dfs-cli/cmd/fdfs-api.go b/cmd/dfs-cli/cmd/fdfs-api.go index 8f48d963..5467c882 100644 --- a/cmd/dfs-cli/cmd/fdfs-api.go +++ b/cmd/dfs-cli/cmd/fdfs-api.go @@ -107,7 +107,7 @@ func (s *fdfsClient) getAccessToken() string { func (s *fdfsClient) postReq(method, urlPath string, jsonBytes []byte) ([]byte, error) { // prepare the request - fullUrl := fmt.Sprintf(s.url + urlPath) + fullUrl := fmt.Sprintf("%s%s", s.url, urlPath) var req *http.Request var err error if jsonBytes != nil { @@ -178,7 +178,7 @@ func (s *fdfsClient) postReq(method, urlPath string, jsonBytes []byte) ([]byte, } func (s *fdfsClient) getReq(urlPath, argsString string) ([]byte, error) { - fullUrl := fmt.Sprintf(s.url + urlPath) + fullUrl := fmt.Sprintf("%s%s", s.url, urlPath) var req *http.Request var err error if argsString != "" { @@ -270,7 +270,7 @@ func (s *fdfsClient) uploadMultipartFile(urlPath, fileName string, fileSize int6 return nil, err } - fullUrl := fmt.Sprintf(s.url + urlPath) + fullUrl := fmt.Sprintf("%s%s", s.url, urlPath) req, err := http.NewRequest(http.MethodPost, fullUrl, body) if err != nil { return nil, err @@ -312,7 +312,7 @@ func (s *fdfsClient) uploadMultipartFile(urlPath, fileName string, fileSize int6 func (s *fdfsClient) downloadMultipartFile(method, urlPath string, arguments map[string]string, out *os.File) (int64, error) { // prepare the request - fullUrl := fmt.Sprintf(s.url + urlPath) + fullUrl := fmt.Sprintf("%s%s", s.url, urlPath) var req *http.Request var err error diff --git a/pkg/blockstore/bee/client.go b/pkg/blockstore/bee/client.go index 95ef7d71..42cfd7da 100644 --- a/pkg/blockstore/bee/client.go +++ b/pkg/blockstore/bee/client.go @@ -180,7 +180,7 @@ func (s *Client) Do(req *http.Request) (*http.Response, error) { func (s *Client) UploadSOC(owner, id, signature string, data []byte) (address []byte, err error) { to := time.Now() socResStr := socResource(owner, id, signature) - fullUrl := fmt.Sprintf(s.url + socResStr) + fullUrl := fmt.Sprintf("%s%s", s.url, socResStr) req, err := http.NewRequest(http.MethodPost, fullUrl, bytes.NewBuffer(data)) if err != nil { @@ -238,7 +238,7 @@ func (s *Client) UploadSOC(owner, id, signature string, data []byte) (address [] // UploadChunk uploads a chunk to Swarm network. func (s *Client) UploadChunk(ch swarm.Chunk) (address []byte, err error) { to := time.Now() - fullUrl := fmt.Sprintf(s.url + chunkUploadDownloadUrl) + fullUrl := fmt.Sprintf("%s%s", s.url, chunkUploadDownloadUrl) req, err := http.NewRequest(http.MethodPost, fullUrl, bytes.NewBuffer(ch.Data())) if err != nil { return nil, err @@ -298,7 +298,7 @@ func (s *Client) DownloadChunk(ctx context.Context, address []byte) (data []byte addrString := swarm.NewAddress(address).String() path := chunkUploadDownloadUrl + "/" + addrString - fullUrl := fmt.Sprintf(s.url + path) + fullUrl := fmt.Sprintf("%s%s", s.url, path) req, err := http.NewRequest(http.MethodGet, fullUrl, bytes.NewBuffer(data)) if err != nil { return nil, err diff --git a/pkg/dir/rmdir.go b/pkg/dir/rmdir.go index 1918a5f7..6ca07012 100644 --- a/pkg/dir/rmdir.go +++ b/pkg/dir/rmdir.go @@ -52,7 +52,7 @@ func (d *Directory) RmDir(directoryNameWithPath, podPassword string) error { return ErrDirectoryNotPresent } - if dirInode.FileOrDirNames != nil && len(dirInode.FileOrDirNames) > 0 { + if len(dirInode.FileOrDirNames) > 0 { for _, fileOrDirName := range dirInode.FileOrDirNames { if strings.HasPrefix(fileOrDirName, "_F_") { fileName := strings.TrimPrefix(fileOrDirName, "_F_") @@ -93,7 +93,7 @@ func (d *Directory) RmRootDir(podPassword string) error { } // recursive delete dirInode := d.GetDirFromDirectoryMap(totalPath) - if dirInode.FileOrDirNames != nil && len(dirInode.FileOrDirNames) > 0 { + if len(dirInode.FileOrDirNames) > 0 { for _, fileOrDirName := range dirInode.FileOrDirNames { if strings.HasPrefix(fileOrDirName, "_F_") { fileName := strings.TrimPrefix(fileOrDirName, "_F_")