- Get Go-lang from official site. Check out the version used in
GO_VERSION
file at the base of this repository. - Add
go
command to your PATH:export PATH=$PATH:/usr/local/go/bin
- Define GOPATH:
export GOPATH=$(go env GOPATH)
- Add Go workspace to your PATH:
export PATH=$PATH:$(go env GOPATH)/bin
- Define the base path:
mkdir -p $GOPATH/src/github.com/apache
- Clone the project:
cd $GOPATH/src/github.com/apache
git clone <project>
cd $GOPATH/src/github.com/apache/<project>
- Define GO111MODULE:
export GO111MODULE=on
to be able to compile locally.
- Run
golangci-lint run
- Run
go mod tidy
- Run
go fmt ./...
- Run
go vet ./...
To compile, type: go build -o ingress-ats main/main.go
The project includes unit tests for the controller written in Golang and the ATS plugin written in Lua.
To run the Golang unit tests: go test ./watcher/ && go test ./redis/
The Lua unit tests use busted
for testing. busted
can be installed using luarocks
:luarocks install busted
. More information on how to install busted is available here.
⚠️ Note that the project uses Lua 5.1 version
To run the Lua unit tests:
cd pluginats
busted connect_redis_test.lua
The repository comes with basic support for both vscode.
If you're using vscode
:
.vscode/settings.json
contains some basic settings for whitespaces and tabs.vscode/extensions.json
contains a few recommended extensions for this project.- It is highly recommended to install the Go extension since it contains the code lint this project used during development.