Categorygithub.com/GersonTf/fire-backend
modulepackage
0.0.0-20231026114518-fc6cc119b570
Repository: https://github.com/gersontf/fire-backend.git
Documentation: pkg.go.dev

# README

Fire-Backend Project

Welcome to the Fire-Backend project.

Running the Fire Backend Project

This project is based on Go 1.21.X You can build and run it as follows:

Building the Project

go build -o fire-backend

Running the Project

Execute the following command:

go run main.go --listenaddr $(listenaddr)

The default listen address is: 8080

Dockerized Version

The project is also dockerized and can be built and run using Docker.

Building the Docker Image

Set the image name:

IMAGE_NAME=fire-backend

Then, build the image:

docker build -t $(IMAGE_NAME) .

Running the Docker Image

docker run -p 8080:8080 $(IMAGE_NAME)

Linting with golangci-lint

This project uses golangci-lint as its linter.

Installation

To install golangci-lint locally, you can use the following command:

curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2

After installation, you can verify the version with:

golangci-lint --version

Usage

To run the lint tests, use the following command:

golangci-lint run

This is equivalent to:

golangci-lint run ./...

For those who prefer Docker, you can use the Docker version as follows:

docker run -t --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.54.2 golangci-lint run -v

to run the tests: go test ./...

add -v (verbose) for more detailed test logs -shuffle=on for executing tests in a random order

Running Tests

To execute the tests, use the following command:

go test ./...

Additional Test Arguments

  1. Verbose Output: To view more detailed test logs, use the -v flag.

    go test ./... -v
    
  2. Randomized Test Execution: If you wish to execute tests in a random order, include the -shuffle=on flag.

    go test ./... -shuffle=on
    
  3. Specific Test Case: To run a particular test case, utilize the run flag followed by the test name. The run flag accepts regex patterns, enabling you to target specific or groups of tests.

    go test ./... -run=<test_pattern>
    

    Replace <test_pattern> with your desired regex pattern or test name.

Documentation

To access the project documentation, follow these steps:

  1. Install the Go documentation tool:

    go install golang.org/x/tools/cmd/godoc
    
  2. Run the documentation server with the play option:

    godoc -play -http ":6060"
    
  3. Once the server is running, you can access the general Go documentation at:

    http://localhost:6060/pkg/
    
  4. For this project's specific documentation, visit:

    http://localhost:6060/pkg/github.com/GersonTf/fire-backend/
    

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
Package types provides shared data types used across the application.
No description provided by the author