Preparing report...

Report for github.com/PacktPublishing/Building-RESTful-Web-Services-with-Go

B    Not bad!    Found 71 issues across 82 files

Tweet

gofmt67%

Gofmt formats Go programs. We run gofmt -s on your code, where -s is for the "simplify" command


go_vet100%

go vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string.

No problems detected. Good job!


gocyclo100%

Gocyclo calculates cyclomatic complexities of functions in Go source code. The cyclomatic complexity of a function is calculated according to the following rules: 1 is the base complexity of a function +1 for each 'if', 'for', 'case', '&&' or '||' Go Report Card warns on functions with cyclomatic complexity > 15.

No problems detected. Good job!


golint68%

Golint is a linter for Go source code.

    • Building-RESTful-Web-Services-with-Go/Chapter08/githubAPI/gitTool.go
    • Line 13: warning: exported var GITHUB_TOKEN should have comment or be unexported (golint)
    • Line 16: warning: comment on exported type Repo should be of the form "Repo ..." (with optional leading article) (golint)
    • Line 25: warning: comment on exported type File should be of the form "File ..." (with optional leading article) (golint)
    • Line 30: warning: exported type Gist should have comment or be unexported (golint)
    • Line 64: warning: don't use underscores in Go names; var requestOptions_copy should be requestOptionsCopy (golint)
    • Building-RESTful-Web-Services-with-Go/Chapter07/jsonstore/models/models.go
    • Line 5: warning: a blank import should be only in a main or test package, or have a comment justifying it (golint)
    • Line 8: warning: exported type User should have comment or be unexported (golint)
    • Line 14: warning: exported type Order should have comment or be unexported (golint)
    • Line 20: warning: comment on exported method User.TableName should be of the form "TableName ..." (golint)
    • Line 25: warning: exported method Order.TableName should have comment or be unexported (golint)
    • Line 30: warning: exported function InitDB should have comment or be unexported (golint)
    • Line 35: warning: if block ends with a return statement, so drop this else and outdent its block (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign20%

IneffAssign detects ineffectual assignments in Go code.

    • Building-RESTful-Web-Services-with-Go/Chapter04/railAPI/main.go
    • Line 10: warning: cannot find package "." in: (ineffassign)
    • Line 11: warning: cannot find package "." in: (ineffassign)
    • Line 12: warning: cannot find package "." in: (ineffassign)
    • Line 10: warning: could not import github.com/emicklei/go-restful (invalid package name: "") (ineffassign)
    • Line 11: warning: could not import github.com/mattn/go-sqlite3 (invalid package name: "") (ineffassign)
    • Line 12: warning: could not import github.com/narenaryan/dbutils (invalid package name: "") (ineffassign)
    • Line 42: warning: undeclared name: restful (ineffassign)
    • Line 57: warning: undeclared name: restful (ineffassign)
    • Line 57: warning: undeclared name: restful (ineffassign)
    • Line 70: warning: undeclared name: restful (ineffassign)
    • Line 70: warning: undeclared name: restful (ineffassign)
    • Line 91: warning: undeclared name: restful (ineffassign)
    • Line 91: warning: undeclared name: restful (ineffassign)
    • Line 43: warning: undeclared name: restful (ineffassign)
    • Line 46: warning: undeclared name: restful (ineffassign)
    • Line 47: warning: undeclared name: restful (ineffassign)
    • Line 110: warning: undeclared name: restful (ineffassign)
    • Line 111: warning: undeclared name: restful (ineffassign)
    • Line 10: warning: "github.com/emicklei/go-restful" imported but not used (ineffassign)
    • Building-RESTful-Web-Services-with-Go/Chapter03/RPCClient.go
    • Line 8: warning: other declaration of Args (ineffassign)
    • Line 11: warning: other declaration of main (ineffassign)
    • Line 11: warning: other declaration of main (ineffassign)
    • Line 11: warning: other declaration of main (ineffassign)
    • Line 11: warning: other declaration of main (ineffassign)
    • Line 8: warning: other declaration of Args (ineffassign)
    • Line 11: warning: other declaration of main (ineffassign)
    • Line 11: warning: other declaration of main (ineffassign)
    • Line 11: warning: other declaration of main (ineffassign)
    • Line 11: warning: other declaration of main (ineffassign)
    • Building-RESTful-Web-Services-with-Go/Chapter01/romanserver/data/roman.go
    • Line 4: warning: cannot use 10 (untyped int constant) as string value in map literal (ineffassign)
    • Line 5: warning: cannot use 9 (untyped int constant) as string value in map literal (ineffassign)
    • Line 6: warning: cannot use 8 (untyped int constant) as string value in map literal (ineffassign)
    • Line 7: warning: cannot use 7 (untyped int constant) as string value in map literal (ineffassign)
    • Line 8: warning: cannot use 6 (untyped int constant) as string value in map literal (ineffassign)
    • Line 9: warning: cannot use 5 (untyped int constant) as string value in map literal (ineffassign)
    • Line 10: warning: cannot use 4 (untyped int constant) as string value in map literal (ineffassign)
    • Line 11: warning: cannot use 3 (untyped int constant) as string value in map literal (ineffassign)
    • Line 12: warning: cannot use 2 (untyped int constant) as string value in map literal (ineffassign)
    • Line 13: warning: cannot use 1 (untyped int constant) as string value in map literal (ineffassign)
    • Line 3: warning: (map[string]string literal) (value of type map[string]string) is not constant (ineffassign)
    • Building-RESTful-Web-Services-with-Go/Chapter04/railAPIRevel/app/controllers/app.go
    • Line 8: warning: cannot find package "." in: (ineffassign)
    • Line 8: warning: could not import github.com/revel/revel (invalid package name: "") (ineffassign)
    • Line 26: warning: c.Params undefined (type App has no field or method Params) (ineffassign)
    • Line 31: warning: c.Response undefined (type App has no field or method Response) (ineffassign)
    • Line 32: warning: c.RenderJSON undefined (type App has no field or method RenderJSON) (ineffassign)
    • Line 38: warning: c.Params undefined (type App has no field or method Params) (ineffassign)
    • Line 41: warning: c.Response undefined (type App has no field or method Response) (ineffassign)
    • Line 42: warning: c.RenderJSON undefined (type App has no field or method RenderJSON) (ineffassign)
    • Line 47: warning: c.Params undefined (type App has no field or method Params) (ineffassign)
    • Line 50: warning: c.Response undefined (type App has no field or method Response) (ineffassign)
    • Line 51: warning: c.RenderText undefined (type App has no field or method RenderText) (ineffassign)
    • Building-RESTful-Web-Services-with-Go/Chapter09/encryptServiceWithLogging/main.go
    • Line 8: warning: cannot find package "." in: (ineffassign)
    • Line 9: warning: cannot find package "." in: (ineffassign)
    • Line 10: warning: cannot find package "." in: (ineffassign)
    • Line 8: warning: could not import github.com/go-kit/kit/log (invalid package name: "") (ineffassign)
    • Line 9: warning: could not import github.com/go-kit/kit/transport/http (invalid package name: "") (ineffassign)
    • Line 10: warning: could not import github.com/narenaryan/encryptService/helpers (invalid package name: "") (ineffassign)
    • Building-RESTful-Web-Services-with-Go/Chapter04/railAPIRevel/tests/apptest.go
    • Line 4: warning: cannot find package "." in: (ineffassign)
    • Line 4: warning: could not import github.com/revel/revel/testing (invalid package name: "") (ineffassign)
    • Line 16: warning: t.Get undefined (type *AppTest has no field or method Get) (ineffassign)
    • Line 17: warning: t.AssertOk undefined (type *AppTest has no field or method AssertOk) (ineffassign)
    • Line 18: warning: t.AssertContentType undefined (type *AppTest has no field or method AssertContentType) (ineffassign)
    • Building-RESTful-Web-Services-with-Go/Chapter08/initFlag.go
    • Line 8: warning: name redeclared in this block (ineffassign)
    • Line 9: warning: age redeclared in this block (ineffassign)
    • Line 16: warning: main redeclared in this block (ineffassign)
    • Line 12: warning: cannot use &name (value of type **string) as *string value in argument to flag.StringVar (ineffassign)
    • Line 13: warning: cannot use &age (value of type **int) as *int value in argument to flag.IntVar (ineffassign)
    • Building-RESTful-Web-Services-with-Go/Chapter07/urlshortener/main.go
    • Line 11: warning: cannot find package "." in: (ineffassign)
    • Line 12: warning: cannot find package "." in: (ineffassign)
    • Line 13: warning: cannot find package "." in: (ineffassign)
    • Line 14: warning: cannot find package "." in: (ineffassign)
    • Line 11: warning: could not import github.com/gorilla/mux (invalid package name: "") (ineffassign)
    • Line 12: warning: could not import github.com/lib/pq (invalid package name: "") (ineffassign)
    • Line 13: warning: could not import github.com/narenaryan/urlshortener/models (invalid package name: "") (ineffassign)
    • Line 14: warning: could not import github.com/narenaryan/urlshortener/utils (invalid package name: "") (ineffassign)
    • Line 11: warning: could not import github.com/gorilla/mux (invalid package name: "") (ineffassign)
    • Line 12: warning: could not import github.com/lib/pq (invalid package name: "") (ineffassign)
    • Line 13: warning: could not import github.com/narenaryan/urlshortener/models (invalid package name: "") (ineffassign)
    • Line 14: warning: could not import github.com/narenaryan/urlshortener/utils (invalid package name: "") (ineffassign)
    • Building-RESTful-Web-Services-with-Go/Chapter06/grpc_example/grpcServer/server.go
    • Line 7: warning: cannot find package "." in: (ineffassign)
    • Line 8: warning: cannot find package "." in: (ineffassign)
    • Line 9: warning: cannot find package "." in: (ineffassign)
    • Line 10: warning: cannot find package "." in: (ineffassign)
    • Line 7: warning: could not import github.com/narenaryan/datafiles (invalid package name: "") (ineffassign)
    • Line 8: warning: could not import golang.org/x/net/context (invalid package name: "") (ineffassign)
    • Line 9: warning: could not import google.golang.org/grpc (invalid package name: "") (ineffassign)
    • Line 10: warning: could not import google.golang.org/grpc/reflection (invalid package name: "") (ineffassign)
    • Building-RESTful-Web-Services-with-Go/Chapter05/movieAPI.go
    • Line 10: warning: cannot find package "." in: (ineffassign)
    • Line 10: warning: could not import github.com/gorilla/mux (invalid package name: "") (ineffassign)
    • Line 21: warning: Movie redeclared in this block (ineffassign)
    • Line 30: warning: BoxOffice redeclared in this block (ineffassign)
    • Line 68: warning: main redeclared in this block (ineffassign)
    • Line 16: warning: other declaration of DB (ineffassign)
    • Line 36: warning: other declaration of GetMovie (ineffassign)
    • Line 52: warning: other declaration of PostMovie (ineffassign)
    • Line 57: warning: movie.ID undefined (type Movie has no field or method ID) (ineffassign)
    • Building-RESTful-Web-Services-with-Go/Chapter05/mgoIntro.go
    • Line 6: warning: cannot find package "." in: (ineffassign)
    • Line 7: warning: cannot find package "." in: (ineffassign)
    • Line 6: warning: could not import gopkg.in/mgo.v2 (invalid package name: "") (ineffassign)
    • Line 7: warning: could not import gopkg.in/mgo.v2/bson (invalid package name: "") (ineffassign)
    • Line 10: warning: other declaration of Movie (ineffassign)
    • Line 18: warning: other declaration of BoxOffice (ineffassign)
    • Line 23: warning: other declaration of main (ineffassign)
    • Line 10: warning: other declaration of Movie (ineffassign)
    • Line 18: warning: other declaration of BoxOffice (ineffassign)
    • Line 23: warning: other declaration of main (ineffassign)
    • Line 24: warning: undeclared name: mgo (ineffassign)
    • Line 6: warning: "gopkg.in/mgo.v2" imported but not used (ineffassign)
    • Building-RESTful-Web-Services-with-Go/Chapter12/jwtAuth/main.go
    • Line 11: warning: cannot find package "." in: (ineffassign)
    • Line 12: warning: cannot find package "." in: (ineffassign)
    • Line 13: warning: cannot find package "." in: (ineffassign)
    • Line 11: warning: could not import github.com/dgrijalva/jwt-go (invalid package name: "") (ineffassign)
    • Line 12: warning: could not import github.com/dgrijalva/jwt-go/request (invalid package name: "") (ineffassign)
    • Line 13: warning: could not import github.com/gorilla/mux (invalid package name: "") (ineffassign)
    • Building-RESTful-Web-Services-with-Go/Chapter04/railAPIGin/main.go
    • Line 8: warning: cannot find package "." in: (ineffassign)
    • Line 9: warning: cannot find package "." in: (ineffassign)
    • Line 10: warning: cannot find package "." in: (ineffassign)
    • Line 8: warning: could not import github.com/gin-gonic/gin (invalid package name: "") (ineffassign)
    • Line 9: warning: could not import github.com/mattn/go-sqlite3 (invalid package name: "") (ineffassign)
    • Line 10: warning: could not import github.com/narenaryan/dbutils (invalid package name: "") (ineffassign)
    • Building-RESTful-Web-Services-with-Go/Chapter04/basicExample.go
    • Line 5: warning: cannot find package "." in: (ineffassign)
    • Line 5: warning: could not import github.com/emicklei/go-restful (invalid package name: "") (ineffassign)
    • Line 11: warning: other declaration of main (ineffassign)
    • Line 18: warning: undeclared name: restful (ineffassign)
    • Line 18: warning: undeclared name: restful (ineffassign)
    • Line 12: warning: undeclared name: restful (ineffassign)
    • Line 14: warning: undeclared name: restful (ineffassign)
    • Line 5: warning: "github.com/emicklei/go-restful" imported but not used (ineffassign)
    • Building-RESTful-Web-Services-with-Go/Chapter03/jsonRPCServer.go
    • Line 5: warning: cannot find package "." in: (ineffassign)
    • Line 6: warning: cannot find package "." in: (ineffassign)
    • Line 7: warning: cannot find package "." in: (ineffassign)
    • Line 5: warning: could not import github.com/gorilla/mux (invalid package name: "") (ineffassign)
    • Line 6: warning: could not import github.com/gorilla/rpc (invalid package name: "") (ineffassign)
    • Line 7: warning: could not import github.com/gorilla/rpc/json (invalid package name: "") (ineffassign)
    • Line 14: warning: Args redeclared in this block (ineffassign)
    • Line 48: warning: main redeclared in this block (ineffassign)
    • Line 40: warning: args.Id undefined (type *Args has no field or method Id) (ineffassign)
    • Building-RESTful-Web-Services-with-Go/Chapter07/jsonstore/main.go
    • Line 10: warning: cannot find package "." in: (ineffassign)
    • Line 11: warning: cannot find package "." in: (ineffassign)
    • Line 12: warning: cannot find package "." in: (ineffassign)
    • Line 13: warning: cannot find package "." in: (ineffassign)
    • Line 10: warning: could not import github.com/gorilla/mux (invalid package name: "") (ineffassign)
    • Line 11: warning: could not import github.com/jinzhu/gorm (invalid package name: "") (ineffassign)
    • Line 12: warning: could not import github.com/lib/pq (invalid package name: "") (ineffassign)
    • Line 13: warning: could not import github.com/narenaryan/jsonstore/models (invalid package name: "") (ineffassign)
    • Building-RESTful-Web-Services-with-Go/Chapter09/encryptServiceWithInstrumentation/main.go
    • Line 11: warning: cannot find package "." in: (ineffassign)
    • Line 15: warning: cannot find package "." in: (ineffassign)
    • Line 12: warning: cannot find package "." in: (ineffassign)
    • Line 13: warning: cannot find package "." in: (ineffassign)
    • Line 11: warning: could not import github.com/go-kit/kit/log (invalid package name: "") (ineffassign)
    • Line 12: warning: could not import github.com/go-kit/kit/transport/http (invalid package name: "") (ineffassign)
    • Line 13: warning: could not import github.com/narenaryan/encryptService/helpers (invalid package name: "") (ineffassign)
    • Line 15: warning: could not import github.com/go-kit/kit/metrics/prometheus (invalid package name: "") (ineffassign)

misspell95%

Misspell Finds commonly misspelled English words