jbaruch / artifactory-go-example

Sample project to demonstrate Go language integration with JFrog Artifactory
https://www.jfrog.com/artifactory
Apache License 2.0
16 stars 52 forks source link

failed to init project goreleaser.yml already exists #2

Open conradwt opened 5 years ago

conradwt commented 5 years ago

On Create and publish a Go binary to Artifactory, When I goreleaser init as part of the 2nd step, I'm getting the following error message:

 ⨯ failed to init project    error=.goreleaser.yml already exists

Then when I move to the 3rd step, I'm getting yet the following message:

$ goreleaser --snapshot

   • releasing using goreleaser dev...
   • loading config file       file=.goreleaser.yml
   • SETTING DEFAULTS FOR:
      • loading environment variables
      • snapshoting              
      • releasing to GitHub      
      • project name             
      • creating archives        
      • building binaries        
      • creating Linux packages with nfpm
      • creating Linux packages with snapcraft
      • calculating checksums    
      • signing artifacts        
      • creating Docker images   
      • releasing to Artifactory 
      • releasing to s3          
      • creating homebrew formula
      • creating Scoop Manifest  
   • RUNNING BEFORE HOOKS
   • CHECKING ./DIST  
   • GETTING AND VALIDATING GIT STATE
      • releasing v0.0.3, commit c84e10847908eb686b50390f610bd218a7f4d028
   ⨯ release failed after 0.08s error=failed to generate snapshot name: template: tmpl:1:13: executing "tmpl" at <.Env.CIRCLE_BUILD_NU...>: map has no entry for key "CIRCLE_BUILD_NUM"
asteinhaus commented 5 years ago

I just had the same issue. The simple solution is to remove the .goreleaser.yml before goreleaser init. To fix this issue I see 2 ways:

  1. Add information about CIRCLE_BUILD to README if Circle-CI is relevant for this example. or
  2. Remove .goreleaser.yml and add it to .gitignore.
retgits commented 5 years ago

Hi @asteinhaus, @conradwt, thanks for reporting the issues!

The information from Circle CI isn't relevant for the tutorial, so you can easily replace that with something else (like name_template: 'build-{{ .Tag }}-{{ .Date }}')

If you update that line (nr 37) in .goreleaser.yml, you can skip the step that does the goreleaser init. I'll create a PR that updates the template so it won't fail if you want to use it as is and update the README to reflect that the init step is optional if you use the provided .goreleaser.yml file