Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

export GOBIN="${PWD}/bin"
export PATH="${GOBIN}:${PATH}"
7 changes: 6 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ jobs:
with:
go-version-file: go.mod

- name: Run Tests
- name: Test Code
run: |
source .envrc
make tools
make tidy
make fmt
make generate
make test

- name: Generate Docs
Expand Down
46 changes: 33 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,50 @@ MODULE := $$(go list -m)
.PHONY: default
default: tidy fmt generate build

.PHONY: upgrade
upgrade:
@go list -m -f '{{if and (not .Main) (not .Indirect)}}{{.Path}}{{end}}' all | xargs go get; \
$(MAKE) tidy
.PHONY: tools
tools:
@go -C tools install tool

.PHONY: update
update:
@go -C tools get $$(go -C tools mod edit -json | jq -r '.Tool[].Path')
@go get $$(go mod edit -json | jq -r '.Require[] | select(.Indirect | not) | .Path')
@$(MAKE) tidy
@$(MAKE) tools
@$(MAKE) build

.PHONY: tidy
tidy:
@go -C tools mod tidy
@go -C tools mod download
@go mod tidy
@go mod download

.PHONY: fmt
fmt:
@go fmt ./...; \
go tool goimports -w -local $(MODULE) .
@gofumpt -l -w -extra .

.PHONY: generate
generate:
@go generate ./...

.PHONY: lint
lint:
@go vet ./...; \
golangci-lint run ./...; \
govulncheck ./...
@go vet ./...
@golangci-lint run ./...
@govulncheck ./...

.PHONY: test
test:
@go test -v ./...
@go test -coverprofile=cover.out -race ./...

.PHONY: cover/html
cover/html: test
@go tool cover -html=cover.out

.PHONY: cover/func
cover/func: test
@go tool cover -func=cover.out

.PHONY: build
build:
Expand Down Expand Up @@ -62,6 +79,9 @@ binary:
if [[ "$${cmd}" == "build" ]]; then \
flags+=(-o "bin/goserve"); \
fi; \
echo "$${cmd}ing goserve@$${version} $$(go env GOOS)/$$(go env GOARCH) cgo=$$(go env CGO_ENABLED)"; \
go mod download; \
go "$${cmd}" "$${flags[@]}" .
echo "$${cmd}ing goserve@$${version}"; \
CGO_ENABLED=0 go "$${cmd}" "$${flags[@]}" .

.PHONY: clean
clean:
@rm -f bin/*
137 changes: 133 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
type="image/x-icon"
href="https://raw.githubusercontent.com/cmgsj/goserve/main/images/favicon.png"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=JetBrains Mono"
/>
</head>
<body class="body">
<header class="header">
Expand Down Expand Up @@ -124,6 +128,80 @@
>
</td>
<td class="file_table_body_row_cell file_table_body_row_cell_right"></td>
</tr><tr class="file_table_body_row">
<td class="file_table_body_row_cell file_table_body_row_cell_left"><svg
aria-hidden="true"
focusable="false"
role="img"
viewBox="0 0 16 16"
width="16"
height="16"
fill="currentColor"
style="
display: inline-block;
vertical-align: text-bottom;
overflow: visible;
"
>
<path
d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1H1.75Z"
/>
</svg><a class="file" href="https://github.com/cmgsj/goserve/tree/main/tools"
>tools</a
>
</td>
<td class="file_table_body_row_cell file_table_body_row_cell_right"></td>
</tr><tr class="file_table_body_row">
<td class="file_table_body_row_cell file_table_body_row_cell_left"><svg
aria-hidden="true"
focusable="false"
role="img"
viewBox="0 0 16 16"
width="16"
height="16"
fill="currentColor"
style="
display: inline-block;
vertical-align: text-bottom;
overflow: visible;
"
>
<path
d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"
/>
</svg><a class="file" href="https://github.com/cmgsj/goserve/tree/main/.envrc"
>.envrc</a
>
</td>
<td class="file_table_body_row_cell file_table_body_row_cell_right"><code class="size">70B</code>
<a
class="file"
href="https://raw.githubusercontent.com/cmgsj/goserve/main/.envrc"
download=".envrc"
>
<svg
aria-hidden="true"
focusable="false"
role="img"
viewBox="0 0 16 16"
width="16"
height="16"
fill="currentColor"
style="
display: inline-block;
user-select: none;
vertical-align: text-bottom;
overflow: visible;
"
>
<path
d="M2.75 14A1.75 1.75 0 0 1 1 12.25v-2.5a.75.75 0 0 1 1.5 0v2.5c0 .138.112.25.25.25h10.5a.25.25 0 0 0 .25-.25v-2.5a.75.75 0 0 1 1.5 0v2.5A1.75 1.75 0 0 1 13.25 14Z"
/>
<path
d="M7.25 7.689V2a.75.75 0 0 1 1.5 0v5.689l1.97-1.969a.749.749 0 1 1 1.06 1.06l-3.25 3.25a.749.749 0 0 1-1.06 0L4.22 6.78a.749.749 0 1 1 1.06-1.06l1.97 1.969Z"
/>
</svg>
</a></td>
</tr><tr class="file_table_body_row">
<td class="file_table_body_row_cell file_table_body_row_cell_left"><svg
aria-hidden="true"
Expand Down Expand Up @@ -299,7 +377,7 @@
>Makefile</a
>
</td>
<td class="file_table_body_row_cell file_table_body_row_cell_right"><code class="size">1.391KB</code>
<td class="file_table_body_row_cell file_table_body_row_cell_right"><code class="size">1.698KB</code>
<a
class="file"
href="https://raw.githubusercontent.com/cmgsj/goserve/main/Makefile"
Expand Down Expand Up @@ -379,6 +457,57 @@
/>
</svg>
</a></td>
</tr><tr class="file_table_body_row">
<td class="file_table_body_row_cell file_table_body_row_cell_left"><svg
aria-hidden="true"
focusable="false"
role="img"
viewBox="0 0 16 16"
width="16"
height="16"
fill="currentColor"
style="
display: inline-block;
vertical-align: text-bottom;
overflow: visible;
"
>
<path
d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"
/>
</svg><a class="file" href="https://github.com/cmgsj/goserve/tree/main/cover.out"
>cover.out</a
>
</td>
<td class="file_table_body_row_cell file_table_body_row_cell_right"><code class="size">14.488KB</code>
<a
class="file"
href="https://raw.githubusercontent.com/cmgsj/goserve/main/cover.out"
download="cover.out"
>
<svg
aria-hidden="true"
focusable="false"
role="img"
viewBox="0 0 16 16"
width="16"
height="16"
fill="currentColor"
style="
display: inline-block;
user-select: none;
vertical-align: text-bottom;
overflow: visible;
"
>
<path
d="M2.75 14A1.75 1.75 0 0 1 1 12.25v-2.5a.75.75 0 0 1 1.5 0v2.5c0 .138.112.25.25.25h10.5a.25.25 0 0 0 .25-.25v-2.5a.75.75 0 0 1 1.5 0v2.5A1.75 1.75 0 0 1 13.25 14Z"
/>
<path
d="M7.25 7.689V2a.75.75 0 0 1 1.5 0v5.689l1.97-1.969a.749.749 0 1 1 1.06 1.06l-3.25 3.25a.749.749 0 0 1-1.06 0L4.22 6.78a.749.749 0 1 1 1.06-1.06l1.97 1.969Z"
/>
</svg>
</a></td>
</tr><tr class="file_table_body_row">
<td class="file_table_body_row_cell file_table_body_row_cell_left"><svg
aria-hidden="true"
Expand All @@ -401,7 +530,7 @@
>go.mod</a
>
</td>
<td class="file_table_body_row_cell file_table_body_row_cell_right"><code class="size">1.328KB</code>
<td class="file_table_body_row_cell file_table_body_row_cell_right"><code class="size">919B</code>
<a
class="file"
href="https://raw.githubusercontent.com/cmgsj/goserve/main/go.mod"
Expand Down Expand Up @@ -452,7 +581,7 @@
>go.sum</a
>
</td>
<td class="file_table_body_row_cell file_table_body_row_cell_right"><code class="size">7.77KB</code>
<td class="file_table_body_row_cell file_table_body_row_cell_right"><code class="size">5.477KB</code>
<a
class="file"
href="https://raw.githubusercontent.com/cmgsj/goserve/main/go.sum"
Expand Down Expand Up @@ -586,7 +715,7 @@
.body {
background-color: var(--body-background-color);
color: var(--body-color);
font-family: -apple-system;
font-family: "JetBrains Mono";
margin: 0;
}
.header {
Expand Down
32 changes: 11 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,24 @@ go 1.24.0
require (
github.com/MakeNowJust/heredoc/v2 v2.0.1
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
github.com/spf13/cobra v1.8.1
github.com/spf13/viper v1.19.0
github.com/spf13/cobra v1.9.1
github.com/spf13/viper v1.20.1
)

require (
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/sagikazarmark/locafero v0.7.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/afero v1.12.0 // indirect
github.com/spf13/cast v1.7.1 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/mod v0.23.0 // indirect
golang.org/x/sync v0.11.0 // indirect
golang.org/x/sys v0.30.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.30.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.21.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

tool golang.org/x/tools/cmd/goimports
Loading