Skip to content

Commit

Permalink
update linter
Browse files Browse the repository at this point in the history
  • Loading branch information
et-nik committed Apr 21, 2024
1 parent d67f8ff commit ff45883
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,12 @@ issues:
- funlen
- revive
- stylecheck

linters-settings:
gosimple:
checks: [ "all" ]
gofmt:
simplify: true
govet:
enable:
- fieldalignment
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ fmt:

.PHONY: lint
lint:
@$(GO) run github.com/golangci/golangci-lint/cmd/[email protected] run --timeout 5m0s ./...
@$(GO) run github.com/golangci/golangci-lint/cmd/[email protected] run --timeout 5m0s ./...

.PHONY: lint-fix
lint-fix:
@$(GO) run github.com/golangci/golangci-lint/cmd/[email protected] run --fix --timeout 5m0s ./...
2 changes: 1 addition & 1 deletion internal/app/gdaemon_scheduler/task_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
2 changes: 1 addition & 1 deletion internal/app/server/commands/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions internal/app/server/commands/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion internal/app/server/files/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/limiter/limiter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion test/functional/gdtasks/commands/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions test/functional/serverscommand/restart/restart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit ff45883

Please sign in to comment.