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

Build failure using Go 1.23 under devenv build #1671

Open
vendion opened this issue Jan 14, 2025 · 0 comments
Open

Build failure using Go 1.23 under devenv build #1671

vendion opened this issue Jan 14, 2025 · 0 comments
Labels
question Further information is requested

Comments

@vendion
Copy link

vendion commented Jan 14, 2025

Using Go 1.23 I am unable to get my project to build when running devenv build but using the Go tool chain directly it works just fine. When building using devenv the packages listed in go.mod, go.sum, and thus gomod2nix.toml cannot be found.

Build error

error: builder for '/nix/store/8sl3kmsgw1bpl73ip5cafrwkwh89v4p0-dbctl-0.0.1.drv' failed with exit code 1;
       last 25 log lines:
       > Running phase: patchPhase
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: configurePhase
       > Running phase: buildPhase
       > Building subPackage .
       > go: ignoring package github.com/rs/zerolog/log which exists in the vendor directory but is missing from vendor/modules.txt. To sync the vendor directory run go mod vendor.
       > go: ignoring package github.com/rs/zerolog/pkgerrors which exists in the vendor directory but is missing from vendor/modules.txt. To sync the vendor directory run go mod vendor.
       > go: ignoring package github.com/rs/zerolog which exists in the vendor directory but is missing from vendor/modules.txt. To sync the vendor directory run go mod vendor.
       > go: ignoring package github.com/spf13/cobra which exists in the vendor directory but is missing from vendor/modules.txt. To sync the vendor directory run go mod vendor.
       > go: ignoring package github.com/spf13/viper which exists in the vendor directory but is missing from vendor/modules.txt. To sync the vendor directory run go mod vendor.
       > go: ignoring package github.com/go-sql-driver/mysql which exists in the vendor directory but is missing from vendor/modules.txt. To sync the vendor directory run go mod vendor.
       > go: ignoring package github.com/romanyx/polluter which exists in the vendor directory but is missing from vendor/modules.txt. To sync the vendor directory run go mod vendor.
       > go: ignoring package github.com/golang-migrate/migrate/v4 which exists in the vendor directory but is missing from vendor/modules.txt. To sync the vendor directory run go mod vendor.
       > go: ignoring package github.com/golang-migrate/migrate/v4/database/mysql which exists in the vendor directory but is missing from vendor/modules.txt. To sync the vendor directory run go mod vendor.
       > go: ignoring package github.com/golang-migrate/migrate/v4/source/file which exists in the vendor directory but is missing from vendor/modules.txt. To sync the vendor directory run go mod vendor.
       > internal/db/db.go:13:2: cannot find module providing package github.com/go-sql-driver/mysql: import lookup disabled by -mod=vendor
       > internal/db/db.go:14:2: cannot find module providing package github.com/rs/zerolog/log: import lookup disabled by -mod=vendor
       > internal/db/db.go:15:2: cannot find module providing package github.com/spf13/viper: import lookup disabled by -mod=vendor
       > pkg/migration/create.go:16:2: cannot find module providing package github.com/golang-migrate/migrate/v4: import lookup disabled by -mod=vendor
       > pkg/migration/run.go:13:2: cannot find module providing package github.com/golang-migrate/migrate/v4/database/mysql: import lookup disabled by -mod=vendor
       > pkg/migration/run.go:14:2: cannot find module providing package github.com/golang-migrate/migrate/v4/source/file: import lookup disabled by -mod=vendor
       > cmd/migrate/create.go:15:2: cannot find module providing package github.com/spf13/cobra: import lookup disabled by -mod=vendor
       > pkg/seed/seed.go:19:2: cannot find module providing package github.com/romanyx/polluter: import lookup disabled by -mod=vendor
       > cmd/root.go:14:2: cannot find module providing package github.com/rs/zerolog: import lookup disabled by -mod=vendor
       > cmd/root.go:16:2: cannot find module providing package github.com/rs/zerolog/pkgerrors: import lookup disabled by -mod=vendor
       For full logs, run 'nix-store -l /nix/store/8sl3kmsgw1bpl73ip5cafrwkwh89v4p0-dbctl-0.0.1.drv'.
Error:   × Failed to run command `/nix/store/8mlflq4jl8cpnfz93i8k3kdcg7lhqwnp-
  │ nix-2.24-devenv/bin/nix --show-trace --extra-experimental-features nix-
  │ command --extra-experimental-features flakes --option warn-dirty false
  │ --keep-going --max-jobs 2 --option eval-cache false --option extra-
  │ substituters https://devenv.cachix.org/ --option extra-trusted-public-
  │ keys devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=
  │ build --no-link --print-out-paths .#devenv.outputs.app -vv --log-format
  │ internal-json`
  ╰─▶ Nix command failed: exit status: 1

devenv.nix

{ pkgs
, lib
, config
, inputs
, ...
}:

let
  pkgs-unstable = import inputs.nixpkgs-unstable { system = pkgs.stdenv.system; };
in
{
  # https://devenv.sh/outputs
  outputs =
    let
      name = "dbctl";
      version = "0.0.1";
    in
    {
      app = import ./default.nix {
        inherit
          lib
          pkgs
          name
          version
          ;
      };
    };

  # https://devenv.sh/basics/
  env = {
    GREET = "RowLogic DB Migration Tool";
    DATABASE_USER = "root";
    DATABASE_PASSWORD = "";
    DATABASE_HOST = "localhost";
    DATABASE_PORT = 3306;
    DATABASE_NAME = "RLAppsDemo";
  };

  # https://devenv.sh/packages/
  packages = with pkgs; [
    git
    cobra-cli
    gomod2nix
  ];

  # https://devenv.sh/languages/
  languages.go = {
    enable = true;
    # package = pkgs-unstable.go;
  };

  # https://devenv.sh/processes/
  # processes.cargo-watch.exec = "cargo-watch";

  # https://devenv.sh/services/
  services.mysql = {
    enable = true;
    initialDatabases = [
      { name = "RLAppsDemo"; }
    ];
  };

  # https://devenv.sh/scripts/
  scripts.hello.exec = ''
    echo hello from $GREET
  '';

  enterShell = ''
    hello
  '';

  # https://devenv.sh/tasks/
  # tasks = {
  #   "myproj:setup".exec = "mytool build";
  #   "devenv:enterShell".after = [ "myproj:setup" ];
  # };

  # https://devenv.sh/tests/
  enterTest = ''
    echo "Running tests"
    go test -v -race ./...
  '';

  # https://devenv.sh/pre-commit-hooks/
  pre-commit.hooks = {
    detect-private-keys.enable = true;
    editorconfig-checker.enable = true;
    golangci-lint.enable = true;
    markdownlint.enable = true;
    shellcheck.enable = true;
  };

  # See full reference at https://devenv.sh/reference/options/
  dotenv.enable = true;
}

default.nix

{ lib
, pkgs
, name
, version
, ...
}:
pkgs.buildGoApplication {
  pname = name;
  version = version;

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

  doCheck = false;

  modules = ./gomod2nix.toml;

  meta = with lib; {
    description = "Database management tool for RowLogic";
    homepage = "";
    maintainers = [ ];
  };
}
@vendion vendion added the question Further information is requested label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant