diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9376132..11c2ea8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,7 +29,7 @@ jobs: - name: Run golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: v1.55.2 + version: v1.57.2 - name: Unit Tests run: go test -race -v $(go list ./... | grep -v /test/) -coverprofile=unit.out diff --git a/.golangci.yml b/.golangci.yml index b46113a..5459e09 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -60,3 +60,12 @@ issues: - funlen - revive - stylecheck + +linters-settings: + gosimple: + checks: [ "all" ] + gofmt: + simplify: true + govet: + enable: + - fieldalignment \ No newline at end of file diff --git a/Makefile b/Makefile index c8072ed..004b71f 100644 --- a/Makefile +++ b/Makefile @@ -6,4 +6,8 @@ fmt: .PHONY: lint lint: - @$(GO) run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2 run --timeout 5m0s ./... \ No newline at end of file + @$(GO) run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57.2 run --timeout 5m0s ./... + +.PHONY: lint-fix +lint-fix: + @$(GO) run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57.2 run --fix --timeout 5m0s ./... \ No newline at end of file diff --git a/internal/app/gdaemon_scheduler/task_manager.go b/internal/app/gdaemon_scheduler/task_manager.go index 0f4ab96..8e46cf9 100644 --- a/internal/app/gdaemon_scheduler/task_manager.go +++ b/internal/app/gdaemon_scheduler/task_manager.go @@ -105,7 +105,7 @@ func (manager *TaskManager) RunWorker(ctx context.Context) { func (manager *TaskManager) Stats() domain.GDTaskStats { stats := domain.GDTaskStats{} - manager.commandsInProgress.Range(func(key, value interface{}) bool { + manager.commandsInProgress.Range(func(_, _ interface{}) bool { stats.WorkingCount++ return true }) diff --git a/internal/app/server/commands/requests.go b/internal/app/server/commands/requests.go index 367d9fc..51bdc8f 100644 --- a/internal/app/server/commands/requests.go +++ b/internal/app/server/commands/requests.go @@ -9,9 +9,9 @@ import ( var errInvalidCommandExecMessage = errors.New("unknown binn value, cannot be presented as execute command message") type commandExec struct { - Kind uint8 Command string WorkDir string + Kind uint8 } func (s *commandExec) UnmarshalBINN(bytes []byte) error { diff --git a/internal/app/server/commands/response.go b/internal/app/server/commands/response.go index 09eebf0..9daeb06 100644 --- a/internal/app/server/commands/response.go +++ b/internal/app/server/commands/response.go @@ -6,9 +6,9 @@ import ( ) type Response struct { - Code response.Code - ExitCode int Output string + ExitCode int + Code response.Code } func (r Response) MarshalBINN() ([]byte, error) { diff --git a/internal/app/server/files/files.go b/internal/app/server/files/files.go index 8460e05..86e3646 100644 --- a/internal/app/server/files/files.go +++ b/internal/app/server/files/files.go @@ -162,7 +162,7 @@ func moveCopy(ctx context.Context, m anyMessage, readWriter io.ReadWriter) error message.Source, message.Destination, copy.Options{ - OnSymlink: func(src string) copy.SymlinkAction { + OnSymlink: func(_ string) copy.SymlinkAction { return copy.Shallow }, }, diff --git a/pkg/limiter/limiter_test.go b/pkg/limiter/limiter_test.go index d3a4f3c..be6d3d8 100644 --- a/pkg/limiter/limiter_test.go +++ b/pkg/limiter/limiter_test.go @@ -20,13 +20,13 @@ func Test_Limiter(t *testing.T) { s := NewAPICallScheduler( 10*time.Millisecond, 5, - func(ctx context.Context, q *Queue) error { + func(_ context.Context, q *Queue) error { q.Get() calledSingle++ count++ return nil }, - func(ctx context.Context, q *Queue) error { + func(_ context.Context, q *Queue) error { n := q.GetN(10) calledBulk++ count += len(n) diff --git a/test/functional/gdtasks/commands/start_test.go b/test/functional/gdtasks/commands/start_test.go index 22f032b..5314ca1 100644 --- a/test/functional/gdtasks/commands/start_test.go +++ b/test/functional/gdtasks/commands/start_test.go @@ -13,7 +13,6 @@ func (suite *Suite) TestStartSuccess() { suite.RunTaskManagerUntilTasksCompleted([]*domain.GDTask{task}) - //nolint:goconst suite.AssertFileContents(suite.WorkPath+"/server/file.txt", []byte("FILE CONTENTS\n")) suite.AssertGDTaskExist( domain.NewGDTask( diff --git a/test/functional/serverscommand/restart/restart_test.go b/test/functional/serverscommand/restart/restart_test.go index 637b250..81e8b65 100644 --- a/test/functional/serverscommand/restart/restart_test.go +++ b/test/functional/serverscommand/restart/restart_test.go @@ -12,8 +12,8 @@ import ( func (suite *Suite) TestRestartViaStartStop_ServerIsActive_ExecutedStatusStopAndStartCommands() { suite.GivenServerIsActive() server := suite.GivenServerWithStartAndStopCommand( - serverscommand.CommandScript+" start", //nolint:goconst - serverscommand.CommandScript+" stop", //nolint:goconst + serverscommand.CommandScript+" start", + serverscommand.CommandScript+" stop", ) cmd := suite.CommandFactory.LoadServerCommand(domain.Restart, server)