github.com/golangci/go-tools@v0.0.0-20190318060251-af6baa5dc196/dist/build.sh (about)

     1  #!/bin/sh -e
     2  
     3  SYSTEMS=(windows linux freebsd darwin)
     4  ARCHS=(amd64 386)
     5  
     6  clean=$(git status --porcelain --untracked-files=no)
     7  if [ -n "$clean" ]; then
     8     echo "There are uncommited changes"
     9     exit 1
    10  fi
    11  
    12  rev=$(git describe --tags --always)
    13  if [ -e "$rev" ]; then
    14      rm -rf "$rev"
    15  fi
    16  mkdir "$rev"
    17  
    18  echo "Revision is ${rev}"
    19  for os in ${SYSTEMS[@]}; do
    20      for arch in ${ARCHS[@]}; do
    21          echo "Building GOOS=$os GOARCH=$arch..."
    22          out="staticcheck_${os}_${arch}"
    23          if [ $os = "windows" ]; then
    24              out="${out}.exe"
    25          fi
    26          CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -o "${rev}/${out}" github.com/golangci/go-tools/cmd/staticcheck
    27          (
    28              cd "$rev"
    29              sha256sum "$out" > "$out".sha256
    30          )
    31      done
    32  done
    33  
    34  (
    35      cd "$rev"
    36      sha256sum -c --strict *.sha256
    37  )