Repository: goreleaser/goreleaser
Pull request #2748 (2021-12-07 20:29:42)

fix: artifacts.json when type is archive
since type is an int, 0 is ignored, so we need to start at 1

codecov[bot]: # [Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/2748?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) Report
> Merging [#2748](https://codecov.io/gh/goreleaser/goreleaser/pull/2748?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) (a9dba92) into [main](https://codecov.io/gh/goreleaser/goreleaser/commit/395266bb9b5cba10310e8482c78f4900153daf4d?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) (395266b) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/goreleaser/goreleaser/pull/2748/graphs/tree.svg?width=650&height=150&src=pr&token=3bJvv6b7hN&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser)](https://codecov.io/gh/goreleaser/goreleaser/pull/2748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser)

```diff
@@           Coverage Diff           @@
##             main    #2748   +/-   ##
=======================================
  Coverage   84.93%   84.93%           
=======================================
  Files         105      105           
  Lines        7977     7977           
=======================================
  Hits         6775     6775           
  Misses        984      984           
  Partials      218      218           
```


| [Impacted Files](https://codecov.io/gh/goreleaser/goreleaser/pull/2748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) | Coverage Δ | |
|---|---|---|
| [internal/artifact/artifact.go](https://codecov.io/gh/goreleaser/goreleaser/pull/2748/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser#diff-aW50ZXJuYWwvYXJ0aWZhY3QvYXJ0aWZhY3QuZ28=) | `98.59% <ø> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/2748?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/2748?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser). Last update [395266b...a9dba92](https://codecov.io/gh/goreleaser/goreleaser/pull/2748?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser).


Patch:
diff --git a/internal/artifact/artifact.go b/internal/artifact/artifact.go
index 521aa8ef..8e8b6185 100644
--- a/internal/artifact/artifact.go
+++ b/internal/artifact/artifact.go
@@ -24,7 +24,7 @@ type Type int
 
 const (
 	// UploadableArchive a tar.gz/zip archive to be uploaded.
-	UploadableArchive Type = iota
+	UploadableArchive Type = iota + 1
 	// UploadableBinary is a binary file to be uploaded.
 	UploadableBinary
 	// UploadableFile is any file that can be uploaded.


Test patch:
diff --git a/internal/artifact/artifact_test.go b/internal/artifact/artifact_test.go
index 827b5e78..096b0b54 100644
--- a/internal/artifact/artifact_test.go
+++ b/internal/artifact/artifact_test.go
@@ -501,6 +501,13 @@ func TestMarshalJSON(t *testing.T) {
 			ExtraID: "adsad",
 		},
 	})
+	artifacts.Add(&Artifact{
+		Name: "foo",
+		Type: UploadableArchive,
+		Extra: map[string]interface{}{
+			ExtraID: "adsad",
+		},
+	})
 	artifacts.Add(&Artifact{
 		Name: "foo",
 		Type: Checksum,
diff --git a/internal/artifact/testdata/TestMarshalJSON.json.golden b/internal/artifact/testdata/TestMarshalJSON.json.golden
index a0091ac8..4f1fa483 100644
--- a/internal/artifact/testdata/TestMarshalJSON.json.golden
+++ b/internal/artifact/testdata/TestMarshalJSON.json.golden
@@ -1,1 +1,1 @@
-[{"name":"foo","type":"Binary","extra":{"ID":"adsad"}},{"name":"foo","type":"Checksum","extra":{"Refresh":"func() error"}}]
\ No newline at end of file
+[{"name":"foo","type":"Binary","extra":{"ID":"adsad"}},{"name":"foo","type":"Archive","extra":{"ID":"adsad"}},{"name":"foo","type":"Checksum","extra":{"Refresh":"func() error"}}]
\ No newline at end of file
diff --git a/internal/pipe/scoop/scoop_test.go b/internal/pipe/scoop/scoop_test.go
index 948156c2..103d5c97 100644
--- a/internal/pipe/scoop/scoop_test.go
+++ b/internal/pipe/scoop/scoop_test.go
@@ -624,6 +624,7 @@ func Test_doRun(t *testing.T) {
 			ctx := tt.args.ctx
 			ctx.Artifacts = artifact.New()
 			for _, a := range tt.artifacts {
+				a.Type = artifact.UploadableArchive
 				ctx.Artifacts.Add(&a)
 			}
 			require.NoError(t, Pipe{}.Default(ctx))