Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add go example #1439

Merged
merged 1 commit into from
Sep 20, 2024
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
13 changes: 13 additions & 0 deletions examples/go/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ pkgs, name, version, ... }:
pkgs.buildGoApplication {
pname = name;
version = version;

src = builtins.path {
path = ./.;
name = "source";
};

## remember to call 'gomod2nix' to generate this file
modules = ./gomod2nix.toml;
}
26 changes: 26 additions & 0 deletions examples/go/devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{ pkgs, lib, config, inputs, ... }:

{
packages = [ pkgs.git pkgs.gomod2nix ];

languages.go.enable = true;

pre-commit.hooks = {
govet = {
enable = true;
pass_filenames = false;
};
gotest.enable = true;
golangci-lint = {
enable = true;
pass_filenames = false;
};
};

outputs = let
name = "my-app";
version = "1.0.0";
in { app = import ./default.nix { inherit pkgs name version; }; };

# See full reference at https://devenv.sh/reference/options/
}
10 changes: 10 additions & 0 deletions examples/go/devenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
inputs:
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling
gomod:
url: github:nix-community/gomod2nix
overlays:
- default
# If you're using non-OSS software, you can set allowUnfree to true.
# allowUnfree: true
Loading