ARTIFACTORY: How to deploy the Go Modules with JFrog CLI

Products
Frog_Artifactory
Content Type
User_Guide
AuthorFullName__c
Yanxiu Wu
articleNumber
000006668
FirstPublishedDate
2025-10-20T12:44:53Z
lastModifiedDate
2025-10-20

ARTIFACTORY: How to deploy the Go Modules with JFrog CLI

Description 

The Go client works through a Git repository that hosts the Go modules source code, and does not provide a way to deploy modules to Artifactory directly. To deploy your Go module to Artifactory, you should use the JFrog CLI. If following the JFrog β€œSet Me Up” guide to deploy the Go modules, you may encounter the error like:

yanxiuw@yanxiuw-mac yan-go-example % jf gp yan-go v1.0.0 --server-id rt-server 16:07:24 [πŸ”΅Info] Using go: go1.25.1 { "status": "failure", "totals": { "success": 0, "failure": 0 } } 16:07:24 [πŸ”΅Info] Trace ID for JFrog Platform logs: 33ef6edd7892bbb4 16:07:24 [🚨Error] the deployer repository is missing from the config file (/Users/yanxiuw/github.com/JFrog/project-examples/yan-go-example/.jfrog/projects/go.yaml) please run 'jf go-config' with your deployer repository information

Root Cause

The root cause of this error is that you don't set the server-id-deploy for go-config, which is missing in the current β€œSet Me Up” guide, and it causes the deployer repository to be missing from the config file.



Resolution 

You should set the server-id-deploy for go-config. Please follow the steps below to set up the JFrog CLI:
  1. Remove the config file, which for the JFrog CLI Go project, in my Mac environment is 
    $Project/.jfrog/projects/go.yaml
    rm -f /Users/<user-name>/github.com/JFrog/project-examples/yan-go-example/.jfrog/projects/go.yaml

  2. Add the config server
    jf c add rt-server --artifactory-url https://<artifactory-server>/artifactory --user <user-name> --password xxxxxxxxxxxx --interactive=false

  3. Set the go-config with server-id-resolve and server-id-deploy
    jf go-config --server-id-resolve rt-server --repo-resolve yan-go --server-id-deploy rt-server --repo-deploy yan-go

    Now you can check the config file has set the resolver and deployer:
    yanxiuw@yanxiuw-mac yan-go-example % cat /Users/<user-name>/github.com/JFrog/project-examples/yan-go-example/.jfrog/projects/go.yaml
    version: 1
    type: go
    resolver:
        repo: yan-go
        serverId: rt-server
    deployer:
        repo: yan-go
        serverId: rt-server

  4. Build the Go project
    jfrog rt go build

  5. Deploy the binary to the Artifactory
    yanxiuw@yanxiuw-mac yan-go-example % jf gp v1.0.0
    16:23:35 [πŸ”΅Info] Using go: go1.25.1
    16:23:38 [πŸ”΅Info] Running 'go list -mod=mod -m' in /Users/yanxiuw/github.com/JFrog/project-examples/yan-go-example
    16:23:38 [πŸ”΅Info] Publishing example.com/myapp to yan-go
    16:23:51 [πŸ”΅Info] These files were uploaded:
    
    πŸ“¦ yan-go
    └── πŸ“ example.com
        └── πŸ“ myapp
            └── πŸ“ @v
                β”œβ”€β”€ πŸ“„ v1.0.0.info
                β”œβ”€β”€ πŸ“„ v1.0.0.mod
                └── πŸ“„ v1.0.0.zip
    
    
    {
      "status": "success",
      "totals": {
        "success": 3,
        "failure": 0
      }
    }
Conclusion

After setting the server-id-deploy for JFrog CLI, we can deploy the Go Modules with JFrog CLI successfully.