Skip to content

Commit

Permalink
Merge pull request #249 from CircleCI-Public/lint-docs
Browse files Browse the repository at this point in the history
[CIRCLE-15511]: Document running `lint` job locally until gometalinter supports Go modules
  • Loading branch information
Zachary Scott authored Jan 3, 2019
2 parents 99c297c + 173a855 commit f9fe918
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
4. Ensure the test suite passes (`make test`).
5. The `--debug` flag is often helpful for debugging HTTP client requests and responses.
6. Format your code with [gofmt](https://golang.org/cmd/gofmt/).
7. Make sure your code lints (`make lint`). Tip: `make dev` will install `gometalinter`.
7. Make sure your code lints (`make lint`). Note: This requires Docker to run inside a local job.

**If you have any questions, feel free to ping us at @CircleCI-Public/dx-clients.**
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ out/
vendor/
.vscode

# For supporting generated config of 2.1 syntax for local testing
.circleci/processed.yml

# Snapcraft Related
parts/
prime/
Expand Down
15 changes: 9 additions & 6 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,20 @@ https://github.com/golang/go/wiki/Modules

We use [`gometalinter`](github.com/alecthomas/gometalinter) for linting.

You can install it via `$ make dev` or manually with:
However, since we updated to Go 1.11 modules this doesn't work.

```
$ go get -u github.com/alecthomas/gometalinter
$ gometalinter --install
```
You will have to run our `lint` job inside a local build in order to lint your code changes.

This requires docker and may fail if the docker is not available on your machine.

Then you can run it with `$ make lint`.
Once you have installed Docker, you can execute the `lint` job locally with `$ make lint`.

## Code coverage

There is also a `coverage` job as part of the build which will lint any code you commit.

This can be run manually with `$ make cover`.

## Editor support

Go has great tooling such as [`gofmt`](https://golang.org/cmd/gofmt/) and [`goimports`](https://godoc.org/golang.org/x/tools/cmd/goimports).
Expand Down
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ cover:

.PHONY: lint
lint:
gometalinter ./...
@echo Executing local build of lint job until gometalinter supports Go 1.11 modules...
@echo This requires Docker to run, so it may fail if docker cannot be found.
@echo
@echo Generating tmp/processed.yml from .circleci/config.yml 2.1 version
go run main.go config process .circleci/config.yml > .circleci/processed.yml
@echo
@echo Running local build..
go run main.go local execute -c .circleci/processed.yml --job lint

.PHONY: doc
doc:
Expand All @@ -35,8 +42,6 @@ doc:
.PHONY: dev
dev:
go get golang.org/x/tools/cmd/godoc
go get -u github.com/alecthomas/gometalinter
gometalinter --install

.PHONY: always
always:

0 comments on commit f9fe918

Please sign in to comment.