Development#

Information for developers contributing to GeoServer CLI.

Getting Started#

Development Setup#

Quick setup for development:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Clone repository
git clone https://gitlab.com/aice/geoserver-cli.git
cd geoserver-cli

# Install tools and hooks
./scripts/setup-git-hooks.sh
./scripts/install-tools.sh

# Build
go build -o geoserver-cli ./cmd/geoserver-cli

# Run tests
go test ./...

Project Structure#

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
geoserver-cli/
├── cmd/geoserver-cli/    # CLI entrypoint
├── internal/
   ├── cli/              # Cobra commands
   ├── config/           # Configuration management
   ├── geoserver/        # GeoServer REST client
   ├── postgis/          # PostGIS client
   └── qgis/             # QGIS export utilities
├── configs/              # Configuration templates
├── docs/                 # Documentation (Hugo)
├── scripts/              # Development scripts
└── .githooks/            # Pre-commit hooks

Code Standards#

All contributions must meet these standards:

  • Formatted: gofmt -w .
  • Vetted: go vet ./... passes
  • Linted: golangci-lint run passes
  • Tested: go test ./... passes
  • Documented: Exported functions have doc comments

Pre-commit hooks enforce these automatically.

Development Workflow#

  1. Fork and clone
  2. Create feature branch: git checkout -b feature/my-feature
  3. Make changes with tests
  4. Run checks: Pre-commit hook runs automatically
  5. Push and create MR

Testing#

Run tests:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# All tests
go test ./...

# With coverage
go test -cover ./...

# Specific package
go test ./internal/geoserver/...

# Verbose output
go test -v ./...

Documentation#

The documentation uses Hugo and is located in docs/:

1
2
3
4
5
6
# Serve locally
cd docs
hugo server

# Build
hugo

See Documentation README for details.

Tools#

Install development tools:

1
./scripts/install-tools.sh

This installs:

  • golangci-lint - Comprehensive linter
  • Other tools as needed

CI/CD#

GitLab CI runs on every push:

  • Lint stage: gofmt, go vet, golangci-lint
  • Test stage: Unit tests
  • Deploy stage: Documentation (main branch only)

See .gitlab-ci.yml for configuration.

Release Process#

  1. Update version in code
  2. Tag release: git tag v1.0.0
  3. Push tag: git push origin v1.0.0
  4. GitLab creates release automatically

Need Help?#