mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-05-31 23:19:45 +02:00
fixed tests and linters
This commit is contained in:
parent
ee915f2316
commit
b4b69ddb25
@ -67,7 +67,7 @@ func (Pipe) Run(config config.ProjectConfig) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sha, err := sha(client, owner, repo, name, out)
|
||||
sha, err := formulaeSHA(client, owner, repo, name, out)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -79,13 +79,13 @@ func (Pipe) Run(config config.ProjectConfig) error {
|
||||
},
|
||||
Content: out.Bytes(),
|
||||
Message: github.String(config.BinaryName + " version " + config.Git.CurrentTag),
|
||||
SHA256: sha,
|
||||
SHA: sha,
|
||||
},
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
func sha(client *github.Client, owner, repo, name string, out bytes.Buffer) (*string, error) {
|
||||
func formulaeSHA(client *github.Client, owner, repo, name string, out bytes.Buffer) (*string, error) {
|
||||
file, _, _, err := client.Repositories.GetContents(
|
||||
owner, repo, name, &github.RepositoryContentGetOptions{},
|
||||
)
|
||||
@ -144,6 +144,7 @@ func dataFor(config config.ProjectConfig, client *github.Client) (result templat
|
||||
BinaryName: config.BinaryName,
|
||||
Caveats: config.Brew.Caveats,
|
||||
Format: config.Archive.Format,
|
||||
SHA256: sum,
|
||||
}, err
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ var defaultTemplateData = templateData{
|
||||
Name: "Test",
|
||||
Repo: "caarlos0/test",
|
||||
Tag: "v0.1.3",
|
||||
SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c68",
|
||||
Format: "tar.gz",
|
||||
}
|
||||
|
||||
@ -33,9 +34,10 @@ func assertDefaultTemplateData(t *testing.T, formulae string) {
|
||||
assert.Contains(formulae, "class Test < Formula")
|
||||
assert.Contains(formulae, "homepage \"https://google.com\"")
|
||||
assert.Contains(formulae, "url \"https://github.com/caarlos0/test/releases/download/v0.1.3/test_Darwin_x86_64.tar.gz\"")
|
||||
assert.Contains(formulae, "head \"https://github.com/caarlos0/test.git\"")
|
||||
assert.Contains(formulae, "sha256 \"1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c68\"")
|
||||
assert.Contains(formulae, "version \"v0.1.3\"")
|
||||
assert.Contains(formulae, "bin.install \"test\"")
|
||||
|
||||
}
|
||||
|
||||
func TestFullFormulae(t *testing.T) {
|
||||
|
@ -12,7 +12,7 @@ func For(path string) (result string, err error) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer file.Close()
|
||||
defer func() { _ = file.Close() }()
|
||||
|
||||
hash := sha256.New()
|
||||
_, err = io.Copy(hash, file)
|
||||
|
Loading…
x
Reference in New Issue
Block a user