Compare commits
No commits in common. "28d0d041b08d275ae22c3c5c4b5b500510ef1181" and "ea0c84547f0c07f58ae7148db20de44d8fda9ab7" have entirely different histories.
28d0d041b0
...
ea0c84547f
39
Dockerfile
39
Dockerfile
@ -1,39 +0,0 @@
|
|||||||
# First stage: Use the golangci-lint image to run the linter
|
|
||||||
FROM golangci/golangci-lint:latest as lint
|
|
||||||
|
|
||||||
# Set the Current Working Directory inside the container
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Copy the go.mod file and the rest of the application code
|
|
||||||
COPY go.mod ./
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# Run golangci-lint
|
|
||||||
RUN golangci-lint run
|
|
||||||
|
|
||||||
RUN sh -c 'test -z "$(gofmt -l .)"'
|
|
||||||
|
|
||||||
# Second stage: Use the official Golang image to run tests
|
|
||||||
FROM golang:1.22 as test
|
|
||||||
|
|
||||||
# Set the Current Working Directory inside the container
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Copy the go.mod file and the rest of the application code
|
|
||||||
COPY go.mod ./
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# Run tests
|
|
||||||
RUN go test -v ./...
|
|
||||||
|
|
||||||
# Final stage: Combine the linting and testing stages
|
|
||||||
FROM golang:1.22 as final
|
|
||||||
|
|
||||||
# Ensure that the linting stage succeeded
|
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=lint /app .
|
|
||||||
COPY --from=test /app .
|
|
||||||
|
|
||||||
# Set the final CMD to something minimal since we only needed to verify lint and tests during build
|
|
||||||
CMD ["echo", "Build and tests passed successfully!"]
|
|
||||||
|
|
3
Makefile
3
Makefile
@ -12,6 +12,3 @@ fmt:
|
|||||||
lint:
|
lint:
|
||||||
golangci-lint run
|
golangci-lint run
|
||||||
sh -c 'test -z "$$(gofmt -l .)"'
|
sh -c 'test -z "$$(gofmt -l .)"'
|
||||||
|
|
||||||
docker:
|
|
||||||
docker build --progress plain .
|
|
||||||
|
1
event.go
1
event.go
@ -15,6 +15,7 @@ type Event struct {
|
|||||||
Data json.RawMessage `json:"data"`
|
Data json.RawMessage `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func NewEvent(level, message string, data json.RawMessage) Event {
|
func NewEvent(level, message string, data json.RawMessage) Event {
|
||||||
return Event{
|
return Event{
|
||||||
ID: uuid.New(),
|
ID: uuid.New(),
|
||||||
|
Loading…
Reference in New Issue
Block a user