Skip to content

How to use a private go library in dagger module? #9178

Closed

Description

@azat-dev

Discussed in #9174

Originally posted by azat-dev December 12, 2024
Hello!

Given:

I am trying to daggerize my application, my dagger module uses a privat repository with go library.
The library installs fine on my host machine

When I execute:

dagger call handle-gitlab-event --source=.

Then I receive:

running post-command: go mod tidy
go: github.com/my_library_name: invalid version: git ls-remote -q origin in /go/pkg/m
/xxxxxxxxx: exit status 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
Confirm the import path was entered correctly.

PS:

As I understand it executes dagger inside a docker container, so it doesn't have access to git credentials
I've read documentation about private modules https://docs.dagger.io/api/remote-modules/, but I think it will not help because I use a private "go library", I think if I will create a private dagger module the problem will persists because it still will not access to my private "go library"

Thank you!

Activity

  1. MikeyIO commented on Dec 15, 2024

    @MikeyIO

    We are also facing this issue. We are trying to adopt Dagger and part of our adoption would require us to be able to import private Go packages but my understanding is that Dagger doesn't currently support this (I believe I saw a similar issue before). Keen to hear if there are any workarounds in the meantime.

    Thanks.

  2. azat-dev commented on Dec 16, 2024

    @azat-dev
    Author

    We are also facing this issue. We are trying to adopt Dagger and part of our adoption would require us to be able to import private Go packages but my understanding is that Dagger doesn't currently support this (I believe I saw a similar issue before). Keen to hear if there are any workarounds in the meantime.

    Thanks.

    Hello, you can look here the answer of one of mainteners

    #9174 (comment)

    I personnally use git subtrees and replace directive for now

    replace github.com/my_remote_repo v1.2.3 => ./my_local_path_to_subtree

  3. rajatjindal commented on Mar 18, 2025

    @rajatjindal
    Contributor

    I believe this should be fixed with #9323. I would be eager to hear if that works well for your usecase (or not). Kindly let me know if I could be of help to verify this.

  4. jedevc commented on Mar 18, 2025

    @jedevc
    Contributor

    Closing this, #9323 should be the fix for this - if it's not possible to configure after that, then it's a separate issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions