Skip to content

Commit

Permalink
Fix examples; Document chi v3.x -> chi v4 upgrade steps
Browse files Browse the repository at this point in the history
  • Loading branch information
VojtechVitek committed Jan 9, 2019
1 parent 8b462cf commit 6c769c9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ go:
- 1.11.x

script:
- GO111MODULE=on go test ./...
- export GO111MODULE=on
- go test ./...
- for i in _examples/*/; do go build $i/*.go || exit 1; done
- >
go_version=$(go version);
if [ ${go_version:13:4} = "1.11" ]; then
go get -u golang.org/x/tools/cmd/goimports;
goimports -d -e ./ | grep '.*' && { echo; echo "Aborting due to non-empty goimports output."; exit 1; } || :;
fi
- cd _examples && for i in */; do GO111MODULE=on go build $i/*.go; done
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
- chi v4 requires Go 1.10.3+ (or Go 1.9.7+)
- chi v4 is a Go module and thus breaks the import path; use `github.com/go-chi/chi/v4` and `github.com/go-chi/chi/v4/middleware`

### Upgrading your codebase from chi v3.x to chi v4

Example using GNU find (`brew install find`):
```
$ find . -type f -name '*.go' -not -path "./vendor/*" -exec sed -i 's+github.com/go-chi/chi+github.com/go-chi/chi/v4+g' {} \;
```

We recommend vendoring the dependencies via `GO111MODULE=on go mod vendor && GO111MODULE=on go mod tidy`.

If your repository still pulls in the old import path, you can figure out why by running `GO111MODULE=on go mod why github.com/go-chi/chi`.

## v3.3.4 (2019-01-07)

Expand Down
1 change: 0 additions & 1 deletion _examples/go.mod

This file was deleted.

4 changes: 2 additions & 2 deletions chi.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// Package chi is a small, idiomatic and composable router for building HTTP services.
//
// chi requires Go 1.7 or newer.
// chi v4 requires Go 1.10.3+ (or Go 1.9.7+).
//
// Example:
// package main
Expand All @@ -25,7 +25,7 @@
// http.ListenAndServe(":3333", r)
// }
//
// See github.com/go-chi/chi/v4/_examples/ for more in-depth examples.
// See https://github.com/go-chi/chi/tree/master/_examples for more in-depth examples.
//
// URL patterns allow for easy matching of path components in HTTP
// requests. The matching components can then be accessed using
Expand Down

0 comments on commit 6c769c9

Please sign in to comment.