ฉันรวบรวมโปรแกรม Go ต่อไปนี้บนกล่อง linux/amd64:
package main
import (
"fmt"
"os/user"
)
func main() {
fmt.Println(user.Current())
}
มันใช้งานได้ดี แต่เมื่อฉันคอมไพล์ข้ามจากกล่อง Mac ฉันได้รับข้อผิดพลาดต่อไปนี้เมื่อฉันรันโปรแกรมนั้นบนกล่อง linux ของฉัน:
user: Current not implemented on linux/amd64
ฉันจะคอมไพล์ และ ใช้ฟังก์ชัน Current ในแพ็คเกจ os/user
ได้อย่างไร
แก้ไข 1: ฉันควรเพิ่มว่านี่คือคำแนะนำที่ฉันเคยใช้ในการตั้งค่าการคอมไพล์ข้ามบนกล่อง Mac ของฉัน: https://code.google.com/p/go-wiki/wiki/WindowsCrossCompiling
แก้ไข 2: การคอมไพล์ข้ามสำหรับ windows/386 ทำงานได้ดี
go version go1.2 darwin/amd64
และลองรันบน Ubuntu 12.04 LTS (Linux xxx 3.2.0-24-generic #39-Ubuntu SMP Mon May 21 16:52:17 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
) - person topskip   schedule 16.12.2013go version go1.2.2 linux/amd64
และมีปัญหาเดียวกันหรือไม่ ฉันคอมไพล์บน linux สำหรับ linux ฉันจะหลีกเลี่ยงปัญหานี้ได้อย่างไร? - person vodolaz095   schedule 24.08.2014