Skip to content

Commit

Permalink
chore: add golines to tools
Browse files Browse the repository at this point in the history
  • Loading branch information
litsynp committed Oct 15, 2024
1 parent 038aafc commit f06a538
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 38 deletions.
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ format\:install:
# gofumpt
# https://github.com/mvdan/gofumpt
go install mvdan.cc/gofumpt@latest
# golines
# https://github.,com/segmentio/golines
go install github.com/segmentio/golines@latest
format:
gofumpt -l -w .
golines -w .

lint\:install:
# golangci-lint
Expand Down Expand Up @@ -52,9 +56,12 @@ clean:
rm -rf ${BUILD_DIR}
make docs:clean

compile:
go build -o ${BUILD_DIR}/${SERVER_BINARY_NAME} ./cmd/server

build:
make docs
go build -o ${BUILD_DIR}/${SERVER_BINARY_NAME} ./cmd/server
make compile

run:
go run ./cmd/server
Expand Down
80 changes: 43 additions & 37 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,47 @@

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

outputs = { self, nixpkgs }:
let
goVersion = 22; # Change this to update the whole stack
overlays = [ (final: prev: { go = prev."go_1_${toString goVersion}"; }) ];
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit overlays system; };
});
in
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [
# go (specified by overlay)
go_1_22

# goimports, godoc, etc.
gotools

# https://github.com/mvdan/gofumpt
gofumpt

# https://github.com/golangci/golangci-lint
golangci-lint

# https://github.com/golang-migrate/migrate
go-migrate

# https://github.com/swaggo/swag
go-swag

# https://github.com/sqlc-dev/sqlc
sqlc
];
};
});
};
outputs = {
self,
nixpkgs,
}: let
goVersion = 22; # Change this to update the whole stack
overlays = [(final: prev: {go = prev."go_1_${toString goVersion}";})];
supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
forEachSupportedSystem = f:
nixpkgs.lib.genAttrs supportedSystems (system:
f {
pkgs = import nixpkgs {inherit overlays system;};
});
in {
devShells = forEachSupportedSystem ({pkgs}: {
default = pkgs.mkShell {
packages = with pkgs; [
# go (specified by overlay)
go_1_22

# goimports, godoc, etc.
gotools

# https://github.com/mvdan/gofumpt
gofumpt

# https://github.com/segmentio/golines
golines

# https://github.com/golangci/golangci-lint
golangci-lint

# https://github.com/golang-migrate/migrate
go-migrate

# https://github.com/swaggo/swag
go-swag

# https://github.com/sqlc-dev/sqlc
sqlc
];
};
});
};
}

0 comments on commit f06a538

Please sign in to comment.