Skip to content

Commit 56d8f82

Browse files
chore: cleanup
1 parent 4d0aa7f commit 56d8f82

File tree

6 files changed

+28
-15
lines changed

6 files changed

+28
-15
lines changed

flake.nix

+20-9
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,32 @@
66
flake-utils.url = "github:numtide/flake-utils";
77
};
88

9-
outputs = { self, nixpkgs, flake-utils }:
10-
flake-utils.lib.eachDefaultSystem (system:
9+
outputs =
10+
{
11+
nixpkgs,
12+
flake-utils,
13+
...
14+
}:
15+
flake-utils.lib.eachDefaultSystem (
16+
system:
1117
let
1218
pkgs = import nixpkgs { inherit system; };
19+
commonPackages = with pkgs; [
20+
nodejs
21+
sqlc
22+
golangci-lint
23+
];
1324
in
1425
{
1526
devShells.default = pkgs.mkShell {
16-
buildInputs = with pkgs; [
17-
nodejs
18-
go_1_23
19-
sqlc
20-
golangci-lint
21-
postgresql_16
22-
];
27+
buildInputs = commonPackages ++ [ pkgs.go_1_23 ];
2328
};
29+
30+
shellHook = ''
31+
export GOTOOLCHAIN="local"
32+
'';
33+
34+
formatter = pkgs.nixfmt-rfc-style;
2435
}
2536
);
2637
}

go.mod

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module go.inout.gg/foundations
22

3-
go 1.23.0
3+
go 1.21
4+
5+
toolchain go1.23.0
46

57
require (
68
github.com/a-h/templ v0.2.747

http/httprequest/request.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func DecodeJSON[T any](r *http.Request) (*T, error) {
2828

2929
var v T
3030
if err := json.NewDecoder(r.Body).Decode(&v); err != nil {
31-
return nil, fmt.Errorf("http/request: unable to decode JSON: %w", err)
31+
return nil, fmt.Errorf("foundations/httprequest: unable to decode JSON: %w", err)
3232
}
3333

3434
if err := Validator.StructCtx(ctx, v); err != nil {
@@ -48,7 +48,7 @@ func DecodeJSON[T any](r *http.Request) (*T, error) {
4848
func DecodeForm[T any](r *http.Request) (*T, error) {
4949
ctx := r.Context()
5050
if err := r.ParseForm(); err != nil {
51-
return nil, fmt.Errorf("http/request: unable to parse form request: %w", err)
51+
return nil, fmt.Errorf("foundations/httprequest: unable to parse form request: %w", err)
5252
}
5353

5454
var v T

http/httpresponse/json.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func JSON(w http.ResponseWriter, v any, status int) error {
1515
w.Header().Set("Content-Type", "application/json")
1616
w.WriteHeader(status)
1717
if err := json.NewEncoder(w).Encode(v); err != nil {
18-
return fmt.Errorf("http/response: unable to encode JSON: %w", err)
18+
return fmt.Errorf("foundations/httpresponse: unable to encode JSON: %w", err)
1919
}
2020

2121
return nil

http/httpresponse/json_devel.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func JSON(w http.ResponseWriter, v any, status int) error {
2121
enc.SetIndent("", JSONIdentation)
2222

2323
if err := enc.Encode(v); err != nil {
24-
return fmt.Errorf("http/response: unable to encode JSON: %w", err)
24+
return fmt.Errorf("foundations/httpresponse: unable to encode JSON: %w", err)
2525
}
2626

2727
return nil

http/httpresponse/templ.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func TEMPL(w http.ResponseWriter, r *http.Request, t templ.Component, status int
1616

1717
err := t.Render(r.Context(), w)
1818
if err != nil {
19-
return fmt.Errorf("http/response: unable to render template: %w", err)
19+
return fmt.Errorf("foundations/httpresponse: unable to render template: %w", err)
2020
}
2121

2222
return nil

0 commit comments

Comments
 (0)