Skip to content

Commit a29348c

Browse files
authored
refactor: update repository structure (#173)
- move code to pkg to make it importable - added badges to README - fix go report spelling errors
1 parent b300880 commit a29348c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+78
-70
lines changed

.goreleaser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ builds:
66
- windows
77
- darwin
88
ldflags:
9-
- -X github.com/envelope-zero/backend/internal/controllers.version={{.Version}}
9+
- -X github.com/envelope-zero/backend/pkg/controllers.version={{.Version}}
1010
archives:
1111
- replacements:
1212
darwin: Darwin

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ repos:
2727
language: system
2828
pass_filenames: false
2929
entry: swag fmt
30-
files: ^internal/.*
30+
files: ^pkg/.*
3131

3232
- id: swag init
3333
name: Create swagger docs.go
3434
language: system
3535
pass_filenames: false
36-
entry: swag init --parseDependency --output ./swag
37-
files: ^internal/.*
36+
entry: swag init --parseDependency --output ./api
37+
files: ^pkg/.*

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
swag/**
1+
api/**

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ COPY go.mod go.sum ./
77
RUN go mod download
88

99
COPY internal ./internal
10-
COPY swag ./swag
10+
COPY api ./api
1111
COPY main.go Makefile ./
1212

1313
ARG VERSION=0.0.0

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ coverage: test
2424
VERSION ?= $(shell git rev-parse HEAD)
2525
.PHONY: build
2626
build:
27-
go build -ldflags "-X github.com/envelope-zero/backend/internal/controllers.version=${VERSION}"
27+
go build -ldflags "-X github.com/envelope-zero/backend/pkg/controllers.version=${VERSION}"

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Envelope Zero backend
22

3+
[![Release](https://img.shields.io/github/release/envelope-zero/backend.svg?style=flat-square)](https://github.com/envelope-zero/backend/releases/latest) [![Go Reference](https://pkg.go.dev/badge/github.com/envelope-zero/backend.svg)](https://pkg.go.dev/github.com/envelope-zero/backend) [![Go Report Card](https://goreportcard.com/badge/github.com/envelope-zero/backend)](https://goreportcard.com/report/github.com/envelope-zero/backend)
4+
35
Envelope Zero is fundamentally rooted in two ideas:
46

57
- Using the [envelope method](https://en.wikipedia.org/wiki/Envelope_system) to budget expenses into envelopes.

swag/docs.go renamed to api/docs.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Package swag GENERATED BY SWAG; DO NOT EDIT
1+
// Package api GENERATED BY SWAG; DO NOT EDIT
22
// This file was generated by swaggo/swag
3-
package swag
3+
package api
44

55
import "github.com/swaggo/swag"
66

@@ -51,6 +51,7 @@ const docTemplate = `{
5151
"tags": [
5252
"General"
5353
],
54+
"summary": "v1 API",
5455
"responses": {
5556
"200": {
5657
"description": "OK",
@@ -1705,6 +1706,7 @@ const docTemplate = `{
17051706
"tags": [
17061707
"General"
17071708
],
1709+
"summary": "API version",
17081710
"responses": {
17091711
"200": {
17101712
"description": "OK",

swag/swagger.json renamed to api/swagger.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"tags": [
4040
"General"
4141
],
42+
"summary": "v1 API",
4243
"responses": {
4344
"200": {
4445
"description": "OK",
@@ -1693,6 +1694,7 @@
16931694
"tags": [
16941695
"General"
16951696
],
1697+
"summary": "API version",
16961698
"responses": {
16971699
"200": {
16981700
"description": "OK",

swag/swagger.yaml renamed to api/swagger.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ paths:
498498
description: OK
499499
schema:
500500
$ref: '#/definitions/controllers.V1Response'
501+
summary: v1 API
501502
tags:
502503
- General
503504
options:
@@ -1613,6 +1614,7 @@ paths:
16131614
description: OK
16141615
schema:
16151616
$ref: '#/definitions/controllers.VersionResponse'
1617+
summary: API version
16161618
tags:
16171619
- General
16181620
options:

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,6 @@ require (
7373
modernc.org/sqlite v1.17.1 // indirect
7474
)
7575

76-
replace github.com/envelope-zero/backend/internal/controllers => ./internal/controllers
76+
replace github.com/envelope-zero/backend/pkg/controllers => ./pkg/controllers
7777

78-
replace github.com/envelope-zero/backend/swag => ./swag
78+
replace github.com/envelope-zero/backend/api => ./api

0 commit comments

Comments
 (0)