Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Feb 23, 2020
1 parent 2b01d49 commit ece2379
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 14 deletions.
File renamed without changes.
1 change: 0 additions & 1 deletion go/doc.go

This file was deleted.

2 changes: 1 addition & 1 deletion go/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3.7'
services:
server:
#image: pathwar/pathwar:latest
build: .
build: ..
restart: unless-stopped
entrypoint:
- /bin/bash
Expand Down
2 changes: 1 addition & 1 deletion go/pkg/pwagent/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ func nginxSendCommand(ctx context.Context, cli *client.Client, nginxContainerID
return errcode.ErrDockerAPIContainerExecInspect.Wrap(err)
}

if stderr != nil && len(stderr) > 0 {
if len(stderr) > 0 {
logger.Debug("exec finished with stderr", zap.String("stderr", string(stderr)))
}
logger.Debug("exec finished",
Expand Down
2 changes: 1 addition & 1 deletion go/pkg/pwapi/api_tool-info.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ func (svc *service) ToolInfo(context.Context, *GetInfo_Input) (*GetInfo_Output,
Commit: pwversion.Commit,
BuiltAt: pwversion.Date,
BuiltBy: pwversion.BuiltBy,
Uptime: int32(time.Now().Sub(svc.startedAt).Seconds()),
Uptime: int32(time.Since(svc.startedAt).Seconds()),
}, nil
}
2 changes: 1 addition & 1 deletion go/pkg/pwapi/api_user-get-session.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (svc *service) loadOAuthUser(subject string) (*pwdb.User, error) {
}

func (svc *service) newUserFromClaims(claims *pwsso.Claims) (*pwdb.User, error) {
if claims.EmailVerified == false {
if !claims.EmailVerified {
return nil, errcode.ErrEmailAddressNotVerified
}

Expand Down
4 changes: 1 addition & 3 deletions go/pkg/pwapi/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ func (svc *service) AuthFuncOverride(ctx context.Context, path string) (context.
}

// cleanup the authorization
if strings.HasPrefix(auth[0], "Bearer ") {
auth[0] = auth[0][7:]
}
auth[0] = strings.TrimPrefix(auth[0], "Bearer ")

token, _, err := svc.sso.TokenWithClaims(auth[0])
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions go/pkg/pwapi/testing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func testingSeasons(t *testing.T, svc Service) *pwdb.SeasonList {
return &list
}

func testingAgents(t *testing.T, svc Service) *pwdb.AgentList {
/*func testingAgents(t *testing.T, svc Service) *pwdb.AgentList {
t.Helper()
db := testingSvcDB(t, svc)
Expand All @@ -32,7 +32,7 @@ func testingAgents(t *testing.T, svc Service) *pwdb.AgentList {
}
return &list
}
}*/

func testingSeasonChallenges(t *testing.T, svc Service) *pwdb.SeasonChallengeList {
t.Helper()
Expand Down
2 changes: 1 addition & 1 deletion rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ go.fmt:
if ! command -v goimports &>/dev/null; then GO111MODULE=off go get golang.org/x/tools/cmd/goimports; fi
@set -e; for dir in `find $(GOMOD_DIR) -type f -name "go.mod" | grep -v /vendor/ | sed 's@/[^/]*$$@@' | sort | uniq`; do ( set -xe; \
cd $$dir; \
goimports -w . \
goimports -w `go list -f '{{.Dir}}' ./...)` \
); done

BUILD_STEPS += go.build
Expand Down
6 changes: 3 additions & 3 deletions tool/screenshoter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func main() {
var host, port, screenshotURL, imgQualityArg string
flag.StringVar(&host, "host", "localhost", "Chrome headless instance ip")
flag.StringVar(&port, "port", "9222", "Chrome headless instance debug port")
flag.StringVar(&screenshotURL, "screenshot-url", "https://www.google.com", "URL of the page to screenshoot")
flag.StringVar(&screenshotURL, "screenshot-url", "https://www.google.com", "URL of the page to screenshot")
flag.StringVar(&imgQualityArg, "img-quality", "90", "PNG Quality (default : 90)")
flag.Parse()

Expand All @@ -55,9 +55,9 @@ func main() {
resp.Body.Close()

var jsonElements chromeDebuggerJSON
json.Unmarshal(jsonResponse, &jsonElements)
err = json.Unmarshal(jsonResponse, &jsonElements)

if len(jsonElements) < 1 {
if err != nil || len(jsonElements) < 1 {
log.Fatal("Couldn't retrieve websocket headless instance URL from JSON")
}

Expand Down

0 comments on commit ece2379

Please sign in to comment.