good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit d4c6bddf authored by Anmol Sethi's avatar Anmol Sethi Committed by GitHub
Browse files

Merge pull request #136 from nhooyr/simplify-root

Simplify root of repository
parents 93d751f3 067b40e2
No related branches found
No related tags found
No related merge requests found
......@@ -7,15 +7,15 @@ jobs:
- checkout
- restore_cache:
keys:
- go-v3-{{ checksum "go.sum" }}
- go-v4-{{ checksum "mod/go.sum" }}
# Fallback to using the latest cache if no exact match is found.
- go-v3-
- run: ./ci/fmt.sh
- go-v4-
- run: ./mod/ci/fmt.sh
- save_cache:
paths:
- /root/gopath
- /root/.cache/go-build
key: go-v3-{{ checksum "go.sum" }}
key: go-v4-{{ checksum "mod/go.sum" }}
lint:
docker:
......@@ -24,15 +24,15 @@ jobs:
- checkout
- restore_cache:
keys:
- go-v3-{{ checksum "go.sum" }}
- go-v4-{{ checksum "mod/go.sum" }}
# Fallback to using the latest cache if no exact match is found.
- go-v3-
- run: ./ci/lint.sh
- go-v4-
- run: ./mod/ci/lint.sh
- save_cache:
paths:
- /root/gopath
- /root/.cache/go-build
key: go-v3-{{ checksum "go.sum" }}
key: go-v4-{{ checksum "mod/go.sum" }}
test:
docker:
......@@ -41,20 +41,20 @@ jobs:
- checkout
- restore_cache:
keys:
- go-v3-{{ checksum "go.sum" }}
- go-v4-{{ checksum "mod/go.sum" }}
# Fallback to using the latest cache if no exact match is found.
- go-v3-
- run: ./ci/test.sh
- go-v4-
- run: ./mod/ci/test.sh
- store_artifacts:
path: ci/out
path: mod/ci/out
destination: out
- save_cache:
paths:
- /root/gopath
- /root/.cache/go-build
key: go-v3-{{ checksum "go.sum" }}
key: go-v4-{{ checksum "mod/go.sum" }}
- store_test_results:
path: ci/out
path: mod/ci/out
workflows:
version: 2
......
......@@ -31,7 +31,7 @@ go get nhooyr.io/websocket
## Examples
For a production quality example that shows off the full API, see the [echo example on the godoc](https://godoc.org/nhooyr.io/websocket#example-package--Echo). On github, the example is at [example_echo_test.go](./example_echo_test.go).
For a production quality example that shows off the full API, see the [echo example on the godoc](https://godoc.org/nhooyr.io/websocket#example-package--Echo). On github, the example is at [./mod/example_echo_test.go](./mod/example_echo_test.go).
Please use the [errors.As](https://golang.org/pkg/errors/#As) function [new in Go 1.13](https://golang.org/doc/go1.13#error_wrapping) to check for [websocket.CloseError](https://godoc.org/nhooyr.io/websocket#CloseError). See the [CloseError godoc example](https://godoc.org/nhooyr.io/websocket#example-CloseError).
......@@ -62,7 +62,7 @@ http.HandlerFunc(func (w http.ResponseWriter, r *http.Request) {
### Client
The client side of this library requires at minimum Go 1.12 as it uses a [new feature
The client side of this library requires at least Go 1.12 as it uses a [new feature
in net/http](https://github.com/golang/go/issues/26937#issuecomment-415855861) to perform WebSocket handshakes.
```go
......
......@@ -23,6 +23,9 @@ Be sure to [correctly link](https://help.github.com/en/articles/closing-issues-u
to an existing issue if one exists. In general, create an issue before a PR to get some
discussion going and to make sure you do not spend time on a PR that may be rejected.
The Go module where development occurs is in the [./mod](./mod) subpath so that the README.md
is immediately visible on the main page.
CI must pass on your changes for them to be merged.
### CI
......@@ -32,21 +35,21 @@ It will collect coverage and report it to [codecov](https://codecov.io/gh/nhooyr
and also upload a `out/coverage.html` artifact that you can click on to interactively
browse coverage.
You can run CI locally. The various steps are located in `ci/*.sh`.
You can run CI locally. The various steps are located in `mod/ci/*.sh`.
1. `ci/fmt.sh` which requires node (specifically prettier).
1. `ci/lint.sh` which requires [shellcheck](https://github.com/koalaman/shellcheck#installing).
1. `ci/test.sh`
1. `ci/run.sh` which runs the above scripts in order.
1. `mod/ci/fmt.sh` which requires node (specifically prettier).
1. `mod/ci/lint.sh` which requires [shellcheck](https://github.com/koalaman/shellcheck#installing).
1. `mod/ci/test.sh`
1. `mod/ci/run.sh` which runs the above scripts in order.
For coverage details locally, please see `ci/out/coverage.html` after running `ci/test.sh`.
For coverage details locally, please see `mod/ci/out/coverage.html` after running `mod/ci/test.sh`.
See [ci/image/Dockerfile](ci/image/Dockerfile) for the installation of the CI dependencies on Ubuntu.
See [mod/ci/image/Dockerfile](mod/ci/image/Dockerfile) for the installation of the CI dependencies on Ubuntu.
You can also run tests normally with `go test`. `ci/test.sh` just passes a default set of flags to
You can also run tests normally with `go test`. `mod/ci/test.sh` just passes a default set of flags to
`go test` to collect coverage, enable the race detector and also prettifies the output.
You can pass flags to `ci/test.sh` if you want to run a specific test or otherwise
You can pass flags to `mod/ci/test.sh` if you want to run a specific test or otherwise
control the behaviour of `go test`.
Coverage percentage from codecov and the CI scripts will be different because they are calculated differently.
File moved
File moved
File moved
File moved
#!/usr/bin/env bash
set -euo pipefail
set -euox pipefail
cd "$(dirname "${0}")"
cd "$(git rev-parse --show-toplevel)"
cd "$(git rev-parse --show-toplevel)/mod"
gen() {
# Unfortunately, this is the only way to ensure go.mod and go.sum are correct.
......@@ -16,7 +16,7 @@ gen() {
fmt() {
gofmt -w -s .
go run go.coder.com/go-tools/cmd/goimports -w "-local=$(go list -m)" .
go run mvdan.cc/sh/cmd/shfmt -i 2 -w -s -sr .
go run mvdan.cc/sh/cmd/shfmt -i 2 -w -s -sr ..
# shellcheck disable=SC2046
npx prettier \
--write \
......@@ -24,11 +24,11 @@ fmt() {
--no-semi \
--trailing-comma all \
--loglevel silent \
$(git ls-files "*.yaml" "*.yml" "*.md")
$(git ls-files "../*.yaml" "../*.yml" "../*.md")
}
unstaged_files() {
git ls-files --other --modified --exclude-standard
git ls-files --other --modified --exclude-standard ..
}
check() {
......
File moved
File moved
......@@ -2,9 +2,9 @@
set -euo pipefail
cd "$(dirname "${0}")"
cd "$(git rev-parse --show-toplevel)"
cd "$(git rev-parse --show-toplevel)/mod"
# shellcheck disable=SC2046
shellcheck -x $(git ls-files "*.sh")
shellcheck -x $(git ls-files "../*.sh")
go vet ./...
go run golang.org/x/lint/golint -set_exit_status ./...
......@@ -4,7 +4,7 @@
set -euo pipefail
cd "$(dirname "${0}")"
cd "$(git rev-parse --show-toplevel)"
cd "$(git rev-parse --show-toplevel)/mod"
./ci/fmt.sh
./ci/lint.sh
......
......@@ -2,7 +2,7 @@
set -euo pipefail
cd "$(dirname "${0}")"
cd "$(git rev-parse --show-toplevel)"
cd "$(git rev-parse --show-toplevel)/mod"
argv=(
go run gotest.tools/gotestsum
......
File moved
File moved
File moved
File moved
File moved
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment