Skip to content

Commit 4dabd98

Browse files
reduce extra dependencies
Signed-off-by: Denis Tingaikin <[email protected]>
1 parent a6aed0b commit 4dabd98

File tree

4 files changed

+15
-28
lines changed

4 files changed

+15
-28
lines changed

cmd/go-header/main.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ import (
2222
"go/token"
2323
"os"
2424

25+
"log"
26+
2527
goheader "github.com/denis-tingaikin/go-header"
2628
"github.com/denis-tingaikin/go-header/version"
27-
"github.com/fatih/color"
28-
"github.com/sirupsen/logrus"
2929
)
3030

3131
const configPath = ".go-header.yml"
@@ -38,7 +38,7 @@ type issue struct {
3838
func main() {
3939
paths := os.Args[1:]
4040
if len(paths) == 0 {
41-
logrus.Fatal("Paths has not passed")
41+
log.Fatal("Paths has not passed")
4242
}
4343
if len(paths) == 1 {
4444
if paths[0] == "version" {
@@ -48,23 +48,23 @@ func main() {
4848
}
4949
c := &goheader.Configuration{}
5050
if err := c.Parse(configPath); err != nil {
51-
logrus.Fatal(err.Error())
51+
log.Fatal(err.Error())
5252
}
5353
v, err := c.GetValues()
5454
if err != nil {
55-
logrus.Fatalf("Can not get values: %v", err.Error())
55+
log.Fatalf("Can not get values: %v", err.Error())
5656
}
5757
t, err := c.GetTemplate()
5858
if err != nil {
59-
logrus.Fatalf("Can not get template: %v", err.Error())
59+
log.Fatalf("Can not get template: %v", err.Error())
6060
}
6161
a := goheader.New(goheader.WithValues(v), goheader.WithTemplate(t))
6262
s := token.NewFileSet()
6363
var issues []*issue
6464
for _, p := range paths {
6565
f, err := parser.ParseFile(s, p, nil, parser.ParseComments)
6666
if err != nil {
67-
logrus.Fatalf("File %v can not be parsed due compilation errors %v", p, err.Error())
67+
log.Fatalf("File %v can not be parsed due compilation errors %v", p, err.Error())
6868
}
6969
i := a.Analyze(&goheader.Target{
7070
Path: p,
@@ -78,9 +78,8 @@ func main() {
7878
}
7979
}
8080
if len(issues) > 0 {
81-
red := color.New(color.FgRed).SprintFunc()
8281
for _, issue := range issues {
83-
fmt.Printf("%v:%v\n%v\n", issue.filePath, issue.Location(), red(issue.Message()))
82+
fmt.Printf("%v:%v\n%v\n", issue.filePath, issue.Location(), issue.Message())
8483
}
8584
os.Exit(-1)
8685
}

config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
"strings"
2424
"time"
2525

26-
"gopkg.in/yaml.v2"
26+
"gopkg.in/yaml.v3"
2727
)
2828

2929
// Configuration represents go-header linter setup parameters

go.mod

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ module github.com/denis-tingaikin/go-header
33
go 1.17
44

55
require (
6-
github.com/fatih/color v1.9.0
7-
github.com/sirupsen/logrus v1.8.1
86
github.com/stretchr/testify v1.7.0
9-
gopkg.in/yaml.v2 v2.2.2
7+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
8+
)
9+
10+
require (
11+
github.com/davecgh/go-spew v1.1.1 // indirect
12+
github.com/pmezard/go-difflib v1.0.0 // indirect
1013
)

go.sum

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
11
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
22
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
33
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4-
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
5-
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
6-
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
7-
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
8-
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
9-
github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM=
10-
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
114
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
125
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
13-
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
14-
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
156
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
16-
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
177
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
188
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
19-
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
20-
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
21-
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
229
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
2310
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
24-
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
25-
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
2611
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
2712
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)