!QCCCSJHEsTIfozrZxz:nixos.org

Nix + Go

232 Members
Go packaging for and with Nixpkgs. | Be excellent to each other.48 Servers

Load older messages


SenderMessageTime
17 May 2024
@hexa:lossy.networkhexadoes the go builder have an interface for disabling tests?08:21:48
@hexa:lossy.networkhexaI've usually gone and just yeeted individual test files, which seems rather coarse08:22:04
@katexochen:matrix.orgPaul Meyer (katexochen)https://nixos.org/manual/nixpkgs/unstable/#ssec-skip-go-tests08:22:47
@katexochen:matrix.orgPaul Meyer (katexochen)Not really, but letting Go skip test cases is slightly cleaner and less error prone than removing test files.08:23:48
@katexochen:matrix.orgPaul Meyer (katexochen)Already thought about moving that into an input, but not sure it is worth it.08:24:44
@katexochen:matrix.orgPaul Meyer (katexochen) * hexa: https://nixos.org/manual/nixpkgs/unstable/#ssec-skip-go-tests 08:25:06
@hexa:lossy.networkhexaah neat, thanks for pointing that out08:25:32
@hexa:lossy.networkhexaand yeah, if that code is well tested, port it into the builder08:36:40
@hexa:lossy.networkhexamakes people less likely to apply crude hacks08:37:06
@hexa:lossy.networkhexa in python we have pytestFlagsArray and on top of that disabledTests and disabledTestsPath fwiw 08:37:44
@hexa:lossy.networkhexa that would map to checkFlags and skippedTests 08:37:58
18 May 2024
@easel:matrix.orgeasel set a profile picture.12:27:42
20 May 2024
@kamillaova:matrix.orgKamilla 'ova joined the room.23:24:04
21 May 2024
@bumperboat:matrix.orgbumperboat changed their display name from bumperboat (UTC+8) to bumperboat (UTC+7).04:34:16
@frederic:scs.ems.hostFrédéric Christ changed their display name from Frédéric Christ 🌴 17.05. to Frédéric Christ.06:41:53
22 May 2024
@bullet-bending-koala:matrix.org@bullet-bending-koala:matrix.org joined the room.03:26:46
@bullet-bending-koala:matrix.org@bullet-bending-koala:matrix.org

Hey! I'm new to the nix build game and trying to get over an error I'm having when attempting to build a go project. I've already posted on the discord with no response(just impatient), but thought to post here as well:

I just started running into an issue referenced here: https://github.com/nix-community/gomod2nix/issues/98

I'm on go 1.22 and not sure how to resolve this issue during the buildPhase. Here is a snippet of how I'm running my phases:

            preBuild = ''
              go work sync
              go vet server/
              go vet infra/
            '';

            buildPhase = ''
              go build -v -o $out/bin/bin_result .
              chmod +x $out/bin/bin_result
            '';

            checkPhase = ''
              go test -v server/
              go test -v infra/
            '';

I've been trying different ways of getting it build such as vendoring prior and generating and having no real success. Here's the error:

Running phase: buildPhase
go: inconsistent vendoring in /private/tmp/nix-build-my-project-0.1.0.drv-1/v94xsm9rfafqgqhmf975928jbhfwyz4b-source:
github.com/jmoiron/sqlx@v1.4.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
github.com/pulumi/pulumi-azure-native-sdk/resources/v2@v2.42.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt

I've already synced, deleted cache, re-vendored and added the -mod=vendor flags when running commands. This is the first time trying out a build step using nix, so any help would be really appreciated.

There are a few things which I just might not be cognisant of when it comes to behaviour - such as what happens during the preBuild and buildPhase for it error out like that and that even though I'm synced, it still prompts this error

03:32:41
@mjolnir:nixos.orgNixOS Moderation Botchanged room power levels.15:25:59
@mjolnir:nixos.orgNixOS Moderation Botchanged room power levels.15:28:13
@drupol:matrix.org@drupol:matrix.org joined the room.16:18:39
@drupol:matrix.org@drupol:matrix.org How can I have the binary godotenv available through nativeBuildInputs ? 16:19:04
@drupol:matrix.org@drupol:matrix.orgContext: https://github.com/NixOS/nixpkgs/pull/31371316:19:57
@drupol:matrix.org@drupol:matrix.orgNever mind ;) got it working I think16:56:15
23 May 2024
@jrick:zettaport.comjrickwhat is the buildGoModule way of making a race-enabled build?17:08:42
@jrick:zettaport.comjricki think adding to go build flags would work.. but that seems deprecated and will be removed later17:09:03
@jrick:zettaport.comjrickoh, i guess ldflags = [ '-race' ]17:27:57
@jrick:zettaport.comjrickeven though it's not a a linker flag, ugh17:28:03
@katexochen:matrix.orgPaul Meyer (katexochen) You can use GOFLAGS for that. 17:34:05
@katexochen:matrix.orgPaul Meyer (katexochen) * jrick: You can use GOFLAGS for that. 17:34:20
@jrick:zettaport.comjrickthanks, that sounds more reasonable17:38:11

Show newer messages


Back to Room ListRoom Version: 9