Skip to content

Commit

Permalink
lint(golangci): Fix GolangCI lints (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
elldritch committed Aug 30, 2018
1 parent e7f9c39 commit 92341dc
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 11 deletions.
3 changes: 3 additions & 0 deletions analyzers/golang/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ func (a *Analyzer) Project(pkg string) (Project, error) {

// Find the nearest lockfile.
tool, manifestDir, err := NearestLockfile(dir)
if err != nil {
return Project{}, err
}

// Find the nearest VCS repository.
_, repoRoot, err := vcs.Nearest(dir)
Expand Down
3 changes: 3 additions & 0 deletions analyzers/maven/maven.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ func New(m module.Module) (*Analyzer, error) {

// Get Maven binary.
mvnBin, _, err := exec.Which("--version", options.Binary, os.Getenv("MAVEN_BINARY"), "mvn")
if err != nil {
log.Warnf("Could not find Maven binary: %s", err.Error())
}

analyzer := Analyzer{
Maven: maven.Maven{
Expand Down
1 change: 1 addition & 0 deletions buildtools/cocoapods/lockfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ func TestLockfileParsing(t *testing.T) {
assert.NoError(t, err)

data, err := json.Marshal(lockfile)
assert.NoError(t, err)
fmt.Printf("%s", string(data))
}
5 changes: 4 additions & 1 deletion cmd/fossa/cmd/analyze/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ func Run(ctx *cli.Context) error {
log.Fatalf("Could not parse template data: %s", err.Error())
}
} else {
display.JSON(normalized)
_, err := display.JSON(normalized)
if err != nil {
log.Fatalf("Could not serialize to JSON: %s", err.Error())
}
}

return nil
Expand Down
2 changes: 0 additions & 2 deletions cmd/fossa/cmd/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import (
var Timeout = "timeout"

const pollRequestDelay = 8 * time.Second
const buildsEndpoint = "/api/revisions/%s/build"
const revisionsEndpoint = "/api/revisions/%s"

var Cmd = cli.Command{
Name: "test",
Expand Down
7 changes: 5 additions & 2 deletions cmd/fossa/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,16 @@ func main() {
}

func Run(ctx *cli.Context) error {
setup.SetContext(ctx)
err := setup.SetContext(ctx)
if err != nil {
return err
}

if config.APIKey() == "" && !ctx.Bool(analyze.ShowOutput) {
return cli.ShowAppHelp(ctx)
}

err := initc.Run(ctx)
err = initc.Run(ctx)
if err != nil {
return err
}
Expand Down
6 changes: 0 additions & 6 deletions cmd/fossa/version/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ var prod = versions{
goversion: "go version go1.10.2 linux/amd64",
}

func testShortStringSpaces(t *testing.T) {
if s := ShortString(); len(strings.Fields(s)) > 1 {
t.Errorf("ShortString() had whitespace: %#v", s)
}
}

func TestShortStringHasNoSpaces(t *testing.T) {
testCases := []versions{
noLdFlags, dev, prod,
Expand Down

0 comments on commit 92341dc

Please sign in to comment.