2016-05-12 20 views
2

Ich möchte Go, die Programmiersprache unter Windows mit MSYS2 verwenden.
Welche Paket soll ich verwenden und wie Fehler zu vermeiden, wie:Verwenden Sie Go lang mit MSYS2

package bufio: unrecognized import path "bufio" 
package bytes: unrecognized import path "bytes" 
package crypto: unrecognized import path "crypto" 
package crypto/des: unrecognized import path "crypto/des" 
package crypto/hmac: unrecognized import path "crypto/hmac" 
package crypto/md5: unrecognized import path "crypto/md5" 
package crypto/rand: unrecognized import path "crypto/rand" 
package crypto/rc4: unrecognized import path "crypto/rc4" 
package crypto/sha256: unrecognized import path "crypto/sha256" 
package crypto/tls: unrecognized import path "crypto/tls" 
package crypto/x509: unrecognized import path "crypto/x509" 
package encoding/base64: unrecognized import path "encoding/base64" 
package encoding/binary: unrecognized import path "encoding/binary" 
package encoding/hex: unrecognized import path "encoding/hex" 
package encoding/json: unrecognized import path "encoding/json" 
package encoding/xml: unrecognized import path "encoding/xml" 
package errors: unrecognized import path "errors" 
package fmt: unrecognized import path "fmt" 
package io: unrecognized import path "io" 
package os: unrecognized import path "os" 
package path/filepath: unrecognized import path "path/filepath" 
package runtime: unrecognized import path "runtime" 
package strconv: unrecognized import path "strconv" 
package strings: unrecognized import path "strings" 
package sync: unrecognized import path "sync" 
package time: unrecognized import path "time" 
package os/exec: unrecognized import path "os/exec" 
package syscall: unrecognized import path "syscall" 
package io/ioutil: unrecognized import path "io/ioutil" 
package regexp: unrecognized import path "regexp" 
package hash: unrecognized import path "hash" 
package net: unrecognized import path "net" 
package sync/atomic: unrecognized import path "sync/atomic" 
package unsafe: unrecognized import path "unsafe" 
package hash/crc32: unrecognized import path "hash/crc32" 
package reflect: unrecognized import path "reflect" 
package unicode/utf16: unrecognized import path "unicode/utf16" 
package unicode: unrecognized import path "unicode" 
package unicode/utf8: unrecognized import path "unicode/utf8" 
package math: unrecognized import path "math" 
package net/http: unrecognized import path "net/http" 
package net/http/httputil: unrecognized import path "net/http/httputil" 
package net/url: unrecognized import path "net/url" 
package path: unrecognized import path "path" 
package sort: unrecognized import path "sort" 
package text/template: unrecognized import path "text/template" 
package log: unrecognized import path "log" 
package os/signal: unrecognized import path "os/signal" 

Antwort

4

Installieren Go lang mit: pacman -S mingw-w64-x86_64-go

konfigurieren env Variablen:

export GOROOT=/mingw64/lib/go 
export GOPATH=/mingw64 

starten mit Go :)

go get herunterladen (in mingw64/src), kompilieren und Binärdateien auf Ihrem pa verfügbar machen th (/mingw64/bin)

+0

Heutzutage sollte man 'GOROOT' nicht schon vor langer Zeit explizit setzen. – kostix

+0

Ich wundere mich dann, wenn Sie "GOROOT" deaktivieren und "go env" ausführen, zeigt es den richtigen (eingebauten) Wert für 'GOROOT' an? – kostix

+0

Ja, leider auf MSYS2, der Standardwert für GOROOT ist falsch, und sogar 'go env' läuft in diesem Fall nicht :( – qwertzguy