For some reason my GolangCI is able to identify unused imports but not able to remove them. This is my GolangCI file used to remove unused import statements, I did specify remove-unused as true:
run:
timeout: 5m
modules-download-mode: mod
linters:
enable:
- errcheck
- goimports
- revive
- govet
- staticcheck
linters-settings:
goimports:
remove-unused: true
misspell:
locale: US
issues:
exclude-use-default: false
max-issues-per-linter: 0
max-same-issues: 0
This is how I am running my golangCI:
lint-build-code: ## Lint the generated Code in the Build Folder
@echo "Linting code in directory: $(GEN_CODE_DIR)/src"
docker run --rm -v $(PWD):/local \
-w /local golangci/golangci-lint:latest \
golangci-lint run --fix --config $(GOLANG_CI) --verbose ./$(GEN_CODE_DIR)/src/**
I wish I could have gotten GolangCI to work but I couldn't. This is what I used to get the job done, if anyone has a way to get GolangCI work let me know.