mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-02-03 13:11:48 +02:00
fixes
This commit is contained in:
parent
efff5d5e17
commit
d8bb50f799
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
dist
|
||||
releasr
|
@ -3,32 +3,29 @@ package build
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
"github.com/goreleaser/releaser/config"
|
||||
"github.com/kardianos/osext"
|
||||
)
|
||||
|
||||
func Build(version string, config config.ProjectConfig) error {
|
||||
currentPath, err := osext.ExecutableFolder()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(currentPath)
|
||||
for _, os := range config.Build.Oses {
|
||||
for _, bos := range config.Build.Oses {
|
||||
for _, arch := range config.Build.Arches {
|
||||
fmt.Println("Building", os, arch)
|
||||
fmt.Println("Building", bos+"/"+arch+"...")
|
||||
cmd := exec.Command(
|
||||
"go", "build",
|
||||
"-ldflags=\"-s -w -X main.version="+version+"\"",
|
||||
"-o", target(os, arch, config.BinaryName),
|
||||
"go",
|
||||
"build",
|
||||
"-ldflags=-s -w -X main.version="+version,
|
||||
"-o", target(bos, arch, config.BinaryName),
|
||||
config.Main,
|
||||
)
|
||||
cmd.Env = append(
|
||||
cmd.Env,
|
||||
"GOOS="+os,
|
||||
"GOOS="+bos,
|
||||
"GOARCH="+arch,
|
||||
// "GOPATH="+
|
||||
"GOROOT="+os.Getenv("GOROOT"),
|
||||
"GOPATH="+os.Getenv("GOPATH"),
|
||||
)
|
||||
var stdout bytes.Buffer
|
||||
cmd.Stdout = &stdout
|
||||
|
@ -2,7 +2,6 @@ package config
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@ -32,7 +31,6 @@ type ProjectConfig struct {
|
||||
}
|
||||
|
||||
func Load(file string) (config ProjectConfig, err error) {
|
||||
log.Println("Loading", file)
|
||||
data, err := ioutil.ReadFile(file)
|
||||
if err != nil {
|
||||
return config, err
|
||||
@ -75,12 +73,11 @@ func fix(config ProjectConfig) ProjectConfig {
|
||||
return config
|
||||
}
|
||||
|
||||
func contains(s string, ss []string) (ok bool) {
|
||||
func contains(s string, ss []string) bool {
|
||||
for _, sx := range ss {
|
||||
if sx == s {
|
||||
ok = true
|
||||
break
|
||||
return true
|
||||
}
|
||||
}
|
||||
return ok
|
||||
return false
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user