Skip to content

Commit ad7c922

Browse files
committed
chore: dev environment
1 parent ff315d0 commit ad7c922

File tree

6 files changed

+88
-2
lines changed

6 files changed

+88
-2
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
tailwind-merge/
2+
playground
3+
.idea
4+
.direnv
5+
*.cov
6+
*.out

.goignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
assets/
2+
*.md
3+
docs/

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
1+
test-watch:
2+
@gotestsum --format=short-verbose --watch
23

34
test:
4-
go test -v -cover ./pkg/twmerge...
5+
@gotestsum --format=short-verbose
6+
7+
test-cover:
8+
@CGO_ENABLED=1 gotestsum -- -race -covermode=atomic -coverprofile="profile.cov" ./... && go tool cover -func=profile.cov | grep -v "100.0%"
9+
10+
lint:
11+
@go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run

flake.lock

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
description = "A Nix-flake-based Go 1.21 development environment";
3+
4+
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
5+
6+
outputs = { self, nixpkgs }:
7+
let
8+
goVersion = 21; # Change this to update the whole stack
9+
10+
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
11+
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
12+
pkgs = import nixpkgs {
13+
inherit system;
14+
overlays = [ self.overlays.default ];
15+
};
16+
});
17+
in
18+
{
19+
overlays.default = final: prev: {
20+
go = final."go_1_${toString goVersion}";
21+
};
22+
23+
devShells = forEachSupportedSystem ({ pkgs }: {
24+
default = pkgs.mkShell {
25+
packages = with pkgs; [
26+
# go (version is specified by overlay)
27+
go
28+
29+
# goimports, godoc, etc.
30+
gotools
31+
32+
# https://github.com/golangci/golangci-lint
33+
golangci-lint
34+
35+
# Tests summaries
36+
gotestsum
37+
];
38+
shellHook = ''
39+
export CGO_ENABLED="0" # disables cgo. Not sure why this fixes debugger on tests in vscode
40+
'';
41+
};
42+
});
43+
};
44+
}

0 commit comments

Comments
 (0)