Skip to content

Commit 3c9acc4

Browse files
committed
lint fixed
1 parent f8d95df commit 3c9acc4

File tree

15 files changed

+97
-43
lines changed

15 files changed

+97
-43
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ Thumbs.db
2222
vendor/
2323
giter
2424
dist/
25+
bin/

.golangci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
linters:
2+
enable-all: true
3+
disable:
4+
- gosec
5+
- gochecknoglobals

.goreleaser.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
before:
2+
hooks:
3+
- go mod download
14
builds:
5+
- env:
6+
- CGO_ENABLED=0
27
-
38
main: ./main.go
49
binary: giter

Makefile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
export PATH := ./bin:$(PATH)
2+
export GO111MODULE := on
3+
4+
# Install all the build and lint dependencies
5+
setup:
6+
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh
7+
go mod download
8+
.PHONY: setup
9+
10+
# Build all files.
11+
build:
12+
@echo "==> Building"
13+
@go build -o bin/giter
14+
.PHONY: build
15+
16+
# Run all the linters
17+
lint:
18+
@./bin/golangci-lint run
19+
.PHONY: lint
20+
21+
# Release binaries to GitHub.
22+
release: build
23+
@echo "==> Releasing"
24+
@goreleaser --rm-dist
25+
@echo "==> Complete"
26+
.PHONY: release
27+
28+
# Clean.
29+
clean:
30+
@rm -rf dist
31+
.PHONY: clean

cmd/add.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cmd
22

33
import (
44
"fmt"
5+
56
"github.com/jsmartx/giter/git"
67
"github.com/jsmartx/giter/store"
78
"github.com/jsmartx/giter/util"

cmd/delete.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ package cmd
33
import (
44
"errors"
55
"fmt"
6+
"strconv"
7+
68
"github.com/jsmartx/giter/store"
79
"github.com/jsmartx/giter/util"
810
"github.com/urfave/cli"
9-
"strconv"
1011
)
1112

1213
func Delete(c *cli.Context) error {
@@ -19,7 +20,7 @@ func Delete(c *cli.Context) error {
1920
s := store.New()
2021
users := s.List(name, true)
2122
if len(users) == 0 {
22-
return errors.New("User not found!")
23+
return errors.New("user not found")
2324
}
2425
u := users[0]
2526
if len(users) > 1 {

cmd/list.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cmd
22

33
import (
44
"fmt"
5+
56
"github.com/jsmartx/giter/git"
67
"github.com/jsmartx/giter/store"
78
"github.com/urfave/cli"

cmd/show.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ package cmd
33
import (
44
"errors"
55
"fmt"
6+
"strconv"
7+
68
"github.com/jsmartx/giter/git"
79
"github.com/jsmartx/giter/store"
810
"github.com/jsmartx/giter/util"
911
"github.com/urfave/cli"
10-
"strconv"
1112
)
1213

1314
func Show(c *cli.Context) error {
@@ -29,7 +30,7 @@ func Show(c *cli.Context) error {
2930
s := store.New()
3031
users := s.List(name, true)
3132
if len(users) == 0 {
32-
return errors.New("User not found!")
33+
return errors.New("user not found")
3334
}
3435
u := users[0]
3536
if len(users) > 1 {

cmd/update.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ package cmd
33
import (
44
"errors"
55
"fmt"
6+
"strconv"
7+
68
"github.com/jsmartx/giter/store"
79
"github.com/jsmartx/giter/util"
810
"github.com/urfave/cli"
9-
"strconv"
1011
)
1112

1213
func Update(c *cli.Context) error {
@@ -19,7 +20,7 @@ func Update(c *cli.Context) error {
1920
s := store.New()
2021
users := s.List(name, true)
2122
if len(users) == 0 {
22-
return errors.New("User not found!")
23+
return errors.New("user not found")
2324
}
2425
u := users[0]
2526
if len(users) > 1 {

cmd/use.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ package cmd
33
import (
44
"errors"
55
"fmt"
6+
"strconv"
7+
68
"github.com/jsmartx/giter/git"
79
"github.com/jsmartx/giter/ssh"
810
"github.com/jsmartx/giter/store"
911
"github.com/jsmartx/giter/util"
1012
"github.com/urfave/cli"
11-
"strconv"
1213
)
1314

1415
func Use(c *cli.Context) error {
@@ -30,7 +31,7 @@ func Use(c *cli.Context) error {
3031
s := store.New()
3132
users := s.List(name, true)
3233
if len(users) == 0 {
33-
return errors.New("User not found!")
34+
return errors.New("user not found")
3435
}
3536
u := users[0]
3637
if len(users) > 1 {

0 commit comments

Comments
 (0)