go

module
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2026 License: Apache-2.0

README

Base Server for Go

CI Coverage Go Report Card Go Version Reference License GitHub stars


Features

  • cloudevents
  • grpc
  • http (echo, gin, mux)
  • long polling
  • socket (tcp, udp)

How to add config


How to use server

  • cloudevents
    • build
      • go build -o ./bin/cloudevents-server ./cloudevents-server/
    • run
      • ./bin/cloudevents-server -config-file ./common/config/config.yaml
  • grpc
    • build
      • go build -o ./bin/grpc-server ./grpc-server/
    • run
      • ./bin/grpc-server -config_file ./common/config/config.yaml
    • log
      • ./grpc-server.log
  • http
    • echo
      • build
        • go build -o ./bin/http-server-echo ./http-server/echo/
      • run
        • ./bin/http-server-echo -config_file ./common/config/config.yaml
      • log
        • ./http-server.log
    • gin
      • build
        • go build -o ./bin/http-server-gin ./http-server/gin/
      • run
        • ./bin/http-server-gin -config_file ./common/config/config.yaml
      • log
        • ./http-server.log
    • mux
      • build
        • go build -o ./bin/http-server-mux ./http-server/mux/
      • run
        • ./bin/http-server-mux -config_file ./common/config/config.yaml
      • log
        • ./http-server.log
  • long-polling
    • build
      • go build -o ./bin/long-polling-server ./long-polling-server/
    • run
      • ./bin/long-polling-server -config_file ./common/config/config.yaml
    • log
      • ./long-polling-server.log
  • socket
    • tcp
      • build
        • go build -o ./bin/socket-server-tcp ./socket-server/tcp/
      • run
        • ./bin/socket-server-tcp -config_file ./common/config/config.yaml
      • log
        • ./socket-server.log
    • udp
      • build
        • go build -o ./bin/socket-server-udp ./socket-server/udp/
      • run
        • ./bin/socket-server-udp -config_file ./common/config/config.yaml
      • log
        • ./socket-server.log

Test and Coverage

  • Test
    • go clean -testcache && go test -cover ./...
  • Coverage
    • make coverage file
      • go clean -testcache && go test -coverprofile=coverage.out -cover $(go list ./... | grep -v "/swagger_docs")
    • convert coverage file to html file
      • go tool cover -html=./coverage.out -o ./coverage.html

Directories

Path Synopsis
common
config
Package config provides a struct that can store json type config file
Package config provides a struct that can store json type config file
log
http-server
echo command
gin command
mux command
socket-server
tcp command
udp command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL