Change lint options

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
Jakub Sztandera 2019-07-10 15:35:00 +02:00
parent 898454ca9a
commit 8cd484a8b0
3 changed files with 12 additions and 5 deletions

View File

@ -89,7 +89,7 @@ jobs:
command: | command: |
bash <(curl -s https://codecov.io/bash) bash <(curl -s https://codecov.io/bash)
lint: lint: &lint
description: | description: |
Run golangci-lint. Run golangci-lint.
parameters: parameters:
@ -124,15 +124,20 @@ jobs:
command: | command: |
golangci-lint run -v \ golangci-lint run -v \
--concurrency << parameters.concurrency >> << parameters.args >> --concurrency << parameters.concurrency >> << parameters.args >>
lint-changes:
<<: *lint
lint-all:
<<: *lint
workflows: workflows:
version: 2 version: 2
ci: ci:
jobs: jobs:
- lint - lint-changes:
- lint: args: "--new-from-rev origin/master"
args: "--no-config --exclude-use-default=false --disable-all --enable golint" - lint-all
- test: - test:
codecov-upload: true codecov-upload: true
- mod-tidy-check - mod-tidy-check

View File

@ -20,7 +20,6 @@ issues:
exclude: exclude:
- "func name will be used as test\\.Test.* by other packages, and that stutters; consider calling this" - "func name will be used as test\\.Test.* by other packages, and that stutters; consider calling this"
- "Potential file inclusion via variable" - "Potential file inclusion via variable"
- "should have( a package)? comment"
exclude-use-default: false exclude-use-default: false
exclude-rules: exclude-rules:

View File

@ -25,12 +25,14 @@ const (
fsLock = "repo.lock" fsLock = "repo.lock"
) )
// FsRepo is struct for repo, use NewFS to create
type FsRepo struct { type FsRepo struct {
path string path string
} }
var _ Repo = &FsRepo{} var _ Repo = &FsRepo{}
// APIEndpoint returns endpoint of API in this repo
func (fsr *FsRepo) APIEndpoint() (multiaddr.Multiaddr, error) { func (fsr *FsRepo) APIEndpoint() (multiaddr.Multiaddr, error) {
p := filepath.Join(fsr.path, fsAPI) p := filepath.Join(fsr.path, fsAPI)
f, err := os.Open(p) f, err := os.Open(p)
@ -56,6 +58,7 @@ func (fsr *FsRepo) APIEndpoint() (multiaddr.Multiaddr, error) {
return apima, nil return apima, nil
} }
// Lock acquires exclusive lock on this repo
func (fsr *FsRepo) Lock() (LockedRepo, error) { func (fsr *FsRepo) Lock() (LockedRepo, error) {
closer, err := fslock.Lock(fsr.path, fsLock) closer, err := fslock.Lock(fsr.path, fsLock)
if err != nil { if err != nil {