Skip to content

Latest commit

 

History

History
62 lines (49 loc) · 2.59 KB

DEVELOPMENT.md

File metadata and controls

62 lines (49 loc) · 2.59 KB

Development

Develop with Go-Lang in Linux

  1. Get Go-lang from official site. Check out the version used in GO_VERSION file at the base of this repository.
  2. Add go command to your PATH: export PATH=$PATH:/usr/local/go/bin
  3. Define GOPATH: export GOPATH=$(go env GOPATH)
  4. Add Go workspace to your PATH: export PATH=$PATH:$(go env GOPATH)/bin
  5. Define the base path: mkdir -p $GOPATH/src/github.com/apache
  6. Clone the project:
    • cd $GOPATH/src/github.com/apache
    • git clone <project>
    • cd $GOPATH/src/github.com/apache/<project>
  7. Define GO111MODULE: export GO111MODULE=on to be able to compile locally.

GO code guidelines

  1. Run golangci-lint run
  2. Run go mod tidy
  3. Run go fmt ./...
  4. Run go vet ./...

Compilation

To compile, type: go build -o ingress-ats main/main.go

Unit Tests

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

Text-Editor

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.