summaryrefslogtreecommitdiff
path: root/.zsh/zshenv/80_go
blob: b7f641350a5d72469074d91201d70cfcc6c955a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# zshenv/80_go
#
# Set variables related to the Go programming language
#
# Copyright © 2010-2017 Tobias Klauser <tklauser@distanz.ch>
# Released under the terms of the Artistic Licence 2.0
#
# Source repository: git://git.distanz.ch/dotfiles/zsh.git

_GOROOT="/usr/local/go"

if [ -d $_GOROOT ] ; then
  export GOPATH="$HOME/go"

  arch="$(uname -m)"
  case "$arch" in
    x86_64) export GOARCH="amd64";;
    i*86)   export GOARCH="386";;
    arm64)  export GOARCH="arm64";;
  esac

  os="$(uname)"
  case "$os" in
    Linux)  export GOOS="linux";;
    Darwin) export GOOS="darwin";;
  esac

  path_prepend $_GOROOT/bin
  if [ -d $GOPATH/bin ] ; then
    path_prepend $GOPATH/bin
  fi
fi

alias gotip=$HOME/src/go/bin/go

# export GO111MODULE=on
# export GOPROXY=direct
# export GOSUMDB=off

# Get all goroutine traces on panic, not just the crashing one. See
# https://github.com/maruel/panicparse#gotraceback
export GOTRACEBACK=all

# Alweays use Go toolchains from executable path
export GOTOOLCHAIN=path

# vim:ft=zsh