This guide is written for contributors who are new to Go and want a reliable local workflow for this repository.
- Go
1.26.0 - Git
- GoLand if you want an IDE workflow
Check your Go version:
go versionExpected result:
go version go1.26.0 linux/amd64cmd/http-streamd: service entrypointinternal/service: HTTP source-to-target transfer logicinternal/pipeline: streaming pipeline stages and extension pointsinternal/server: gRPC server wiringapi/httpstream/v1: proto contract
git clone https://github.com/OpenProjectX/http-stream.git
cd http-streamBuild the server binary:
go build ./cmd/http-streamdBuild all packages:
go build ./...Build the Docker image:
docker build -t http-stream:local .Start the service with the default listen address:
go run ./cmd/http-streamdStart the service on a custom address:
HTTP_STREAM_LISTEN_ADDR=:9090 go run ./cmd/http-streamdRun the full test suite:
go test ./...Run tests for one package:
go test ./internal/serviceRun tests with verbose output:
go test -v ./...Format all Go files before committing:
gofmt -w ./cmd ./internalIf you changed more directories, format those files too.
If you add or remove imports from external modules, update the module files:
go mod tidyThis updates go.mod and go.sum.
The repository publishes container images through:
.github/workflows/publish-image.yml
The workflow pushes to:
ghcr.io/openprojectx/http-stream
The image tag format is the first 8 characters of the commit SHA. The workflow also uses Docker Buildx cache via GitHub Actions cache storage to speed up repeated builds.
- Open GoLand.
- Choose
Openand select the repository root. - Wait for GoLand to index the project and detect
go.mod. - Make sure the project SDK points to Go
1.26.0. - Open
cmd/http-streamd/main.goif you want to run the service from the IDE.
To run the service from GoLand:
- Open
Run>Edit Configurations. - Add a new
Go BuildorGo Applicationconfiguration. - Set the package path to
github.com/OpenProjectX/http-stream/cmd/http-streamdor select thecmd/http-streamddirectory. - Optional: add
HTTP_STREAM_LISTEN_ADDR=:9090as an environment variable. - Run the configuration.
- Open a
_test.gofile and click the gutter run icon. - Or right-click a package directory such as
internal/serviceand chooseRun 'Go Tests in ...'.
- Create a new type in
internal/pipeline. - Make it satisfy the
pipeline.Stageinterface. - Register it in
cmd/http-streamd/main.go. - Add unit tests for the stage.
- Update
README.mdif the new stage is user-facing.
Example extension points:
- compression
- encryption
- checksumming
- throttling
- Create a branch.
- Make a focused change.
- Run
gofmt -w ./cmd ./internal. - Run
go test ./.... - Commit with a clear message.
- Open a pull request.
internal/...packages are intentionally private to this module.- Streaming code usually works with
io.Reader,io.Writer, andio.ReadCloser. - Avoid loading the entire payload into memory unless there is a strong reason.
- Prefer small, testable packages over large files with mixed responsibilities.
Please make sure:
- the project builds
- tests pass
- code is formatted
- new behavior has tests where practical
- docs are updated when the public behavior changes