chore: 🔧 Changes that do not modify src or test files

This commit is contained in:
Paramtamtam 2023-02-23 21:50:35 +04:00
parent 5343d8c934
commit b84b3ba9f4
No known key found for this signature in database
GPG Key ID: 366371698FAD0A2B
5 changed files with 20 additions and 37 deletions

View File

@ -1,14 +1,9 @@
.dockerignore
Dockerfile
.github
.git
.gitignore
.editorconfig
.idea
.vscode
test
temp
tmp
LICENSE
Makefile
error-pages
## Ignore everything
*
## Except the following files and directories
!/cmd
!/internal
!/templates
!/error-pages.yml
!/go.*

View File

@ -7,11 +7,8 @@ charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.{yml, yaml, sh, conf, json}]
indent_size = 2
trim_trailing_whitespace = true
[{Makefile, go.mod, *.go}]
indent_style = tab

View File

@ -3,7 +3,7 @@
# Makefile readme (en): <https://www.gnu.org/software/make/manual/html_node/index.html#SEC_Contents>
SHELL = /bin/sh
LDFLAGS = "-s -w -X github.com/tarampampam/error-pages/internal/version.version=$(shell git rev-parse HEAD)"
LDFLAGS = "-s -w -X gh.tarampamp.am/error-pages/internal/version.version=$(shell git rev-parse HEAD)"
DC_RUN_ARGS = --rm --user "$(shell id -u):$(shell id -g)"
APP_NAME = $(notdir $(CURDIR))

View File

@ -1,17 +1,13 @@
package main
import (
crypto "crypto/rand"
"encoding/binary"
"math/rand"
"os"
"path/filepath"
"time"
"github.com/fatih/color"
"go.uber.org/automaxprocs/maxprocs"
"github.com/tarampampam/error-pages/internal/cli"
"gh.tarampamp.am/error-pages/internal/cli"
)
// set GOMAXPROCS to match Linux container CPU quota.
@ -26,15 +22,6 @@ func main() { exitFn(run()) }
// run this CLI application.
// Exit codes documentation: <https://tldp.org/LDP/abs/html/exitcodes.html>
func run() int {
var b [8]byte
// seed random number generator
if _, err := crypto.Read(b[:]); err == nil {
rand.Seed(int64(binary.LittleEndian.Uint64(b[:]))) // https://stackoverflow.com/a/54491783/2252921
} else {
rand.Seed(time.Now().UnixNano()) // fallback
}
if err := (cli.NewApp(filepath.Base(os.Args[0]))).Run(os.Args); err != nil {
_, _ = color.New(color.FgHiRed, color.Bold).Fprintln(os.Stderr, err.Error())

View File

@ -4,6 +4,7 @@ version: '3.8'
volumes:
tmp-data: {}
golint-go: {}
golint-cache: {}
services:
@ -18,27 +19,29 @@ services:
- /etc/group:/etc/group:ro
- .:/src:rw
- tmp-data:/tmp:rw
security_opt: [no-new-privileges:true]
web:
<<: *app-service
ports:
- "8080:8080/tcp" # Open <http://127.0.0.1:8080>
command: sh -c "go build -buildvcs=false -o /tmp/app ./cmd/error-pages && /tmp/app serve"
command: sh -c "go build -buildvcs=false -o /tmp/app ./cmd/error-pages && /tmp/app serve --show-details --proxy-headers=X-Foo,Bar,Baz_blah"
healthcheck:
test: ['CMD', '/tmp/app', '--log-json', 'healthcheck']
interval: 4s
timeout: 1s
start_period: 5s
retries: 5
golint:
image: golangci/golangci-lint:v1.51-alpine # Image page: <https://hub.docker.com/r/golangci/golangci-lint>
environment:
GOLANGCI_LINT_CACHE: /tmp/golint # <https://github.com/golangci/golangci-lint/blob/v1.42.0/internal/cache/default.go#L68>
volumes:
- .:/src:ro
- golint-go:/go:rw # go dependencies will be downloaded on each run without this
- golint-cache:/tmp/golint:rw
- .:/src:ro
working_dir: /src
command: /bin/true
security_opt: [no-new-privileges:true]
hurl:
image: orangeopensource/hurl:1.8.0
@ -47,3 +50,4 @@ services:
working_dir: /src
depends_on:
web: {condition: service_healthy}
security_opt: [no-new-privileges:true]