求大佬帮帮我,我为什么go run, go build都用不起

clever_mike · 2018-08-02 16:11:49 · 3985 次点击 · 大约8小时之前 开始浏览    置顶
这是一个创建于 2018-08-02 16:11:49 的主题,其中的信息可能已经有所发展或是发生改变。

[root@Dev72 learn]# cat a.go package main

import "fmt"

func main() { Println("aaaa") } [root@Dev72 learn]# go run a.go

errors

flag provided but not defined: -std usage: compile [options] file.go... -% debug non-static initializers -+ compiling runtime -B disable bounds checking -D path set relative path for local imports -E debug symbol export -I directory add directory to import search path -K debug missing line numbers -N disable optimizations -S print assembly listing -V print compiler version -W debug parse tree after type checking -asmhdr file write assembly header to file -bench file append benchmark times to file -buildid id record id as the build id in the export metadata -complete compiling complete package (no C or assembly) -cpuprofile file write cpu profile to file -d list print debug information about items in list -dynlink support references to Go symbols defined in other shared libraries -e no limit on number of errors reported -f debug stack frames -h halt on error -i debug line number stack -importmap definition add definition of the form source=actual to import map -installsuffix suffix set pkg directory suffix -j debug runtime-initialized variables -l disable inlining -largemodel generate code that assumes a large memory model -linkobj file write linker-specific object to file -live debug liveness analysis -m print optimization decisions -memprofile file write memory profile to file -memprofilerate rate set runtime.MemProfileRate to rate -msan build code compatible with C/C++ memory sanitizer -nolocalimports reject local (relative) imports -o file write output to file -p path set expected package import path -pack write package file instead of object file -r debug generated wrappers -race enable race detector -s warn about composite literals that can be simplified -shared generate code that can be linked into a shared library -traceprofile file write an execution trace to file -trimpath prefix remove prefix from recorded source file paths -u reject unsafe code -v increase debug verbosity -w debug type checking -wb enable write barrier (default true)

internal/race

flag provided but not defined: -std usage: compile [options] file.go... -% debug non-static initializers -+ compiling runtime -B disable bounds checking -D path set relative path for local imports -E debug symbol export -I directory add directory to import search path -K debug missing line numbers -N disable optimizations -S print assembly listing -V print compiler version -W debug parse tree after type checking -asmhdr file write assembly header to file -bench file append benchmark times to file -buildid id record id as the build id in the export metadata -complete compiling complete package (no C or assembly) -cpuprofile file write cpu profile to file -d list print debug information about items in list -dynlink support references to Go symbols defined in other shared libraries -e no limit on number of errors reported -f debug stack frames -h halt on error -i debug line number stack -importmap definition add definition of the form source=actual to import map -installsuffix suffix set pkg directory suffix -j debug runtime-initialized variables -l disable inlining -largemodel generate code that assumes a large memory model -linkobj file write linker-specific object to file -live debug liveness analysis -m print optimization decisions -memprofile file write memory profile to file -memprofilerate rate set runtime.MemProfileRate to rate -msan build code compatible with C/C++ memory sanitizer -nolocalimports reject local (relative) imports -o file write output to file -p path set expected package import path -pack write package file instead of object file -r debug generated wrappers -race enable race detector -s warn about composite literals that can be simplified -shared generate code that can be linked into a shared library -traceprofile file write an execution trace to file -trimpath prefix remove prefix from recorded source file paths -u reject unsafe code -v increase debug verbosity -w debug type checking -wb enable write barrier (default true) go tool asm: exit status 2 flag provided but not defined: -V usage: asm [options] file.s ... Flags: -D value predefined symbol with optional simple value -D=identifier=value; can be set multiple times -I value include directory; can be set multiple times -S print assembly and machine code -debug dump instructions as they are parsed -dynlink support references to Go symbols defined in other shared libraries -e no limit on number of errors reported -o string output file; default foo.o for /a/b/c/foo.s as first argument -shared generate code that can be linked into a shared library -trimpath string remove prefix from recorded source file paths


有疑问加站长微信联系(非本文作者)

第 1 条附言  ·  2018-08-09 08:05:33

改成fmt.Println了 结果还是一样的

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

3985 次点击  
加入收藏 微博
12 回复  |  直到 2018-08-09 13:50:01
GoLoe
GoLoe · #1 · 7年之前

{ fmt.Println("aaaa") }

clever_mike
clever_mike · #2 · 7年之前
GoLoeGoLoe #1 回复

{ fmt.Println("aaaa") }

复制过来是这样的。其实是 func main() { Println("aaaa") }

clever_mike
clever_mike · #3 · 7年之前
GoLoeGoLoe #1 回复

{ fmt.Println("aaaa") }

对不起,我看错了。 谢谢指点

clever_mike
clever_mike · #4 · 7年之前
GoLoeGoLoe #1 回复

{ fmt.Println("aaaa") }

[root@Dev72 mike]# cat main.go package main

import "fmt"

func main(){ fmt.Println("aa") } [root@Dev72 mike]# go run main.go

errors

flag provided but not defined: -std usage: compile [options] file.go... -% debug non-static initializers -+ compiling runtime -B disable bounds checking -D path set relative path for local imports -E debug symbol export -I directory add directory to import search path -K debug missing line numbers -N disable optimizations -S print assembly listing -V print compiler version -W debug parse tree after type checking -asmhdr file write assembly header to file -bench file append benchmark times to file -buildid id record id as the build id in the export metadata -complete compiling complete package (no C or assembly) -cpuprofile file write cpu profile to file -d list print debug information about items in list -dynlink support references to Go symbols defined in other shared libraries -e no limit on number of errors reported -f debug stack frames -h halt on error -i debug line number stack -importmap definition add definition of the form source=actual to import map -installsuffix suffix set pkg directory suffix -j debug runtime-initialized variables -l disable inlining -largemodel generate code that assumes a large memory model -linkobj file write linker-specific object to file -live debug liveness analysis -m print optimization decisions -memprofile file write memory profile to file -memprofilerate rate set runtime.MemProfileRate to rate -msan build code compatible with C/C++ memory sanitizer -nolocalimports reject local (relative) imports -o file write output to file -p path set expected package import path -pack write package file instead of object file -r debug generated wrappers -race enable race detector -s warn about composite literals that can be simplified -shared generate code that can be linked into a shared library -traceprofile file write an execution trace to file -trimpath prefix remove prefix from recorded source file paths -u reject unsafe code -v increase debug verbosity -w debug type checking -wb enable write barrier (default true)

internal/race

flag provided but not defined: -std usage: compile [options] file.go... -% debug non-static initializers -+ compiling runtime -B disable bounds checking -D path set relative path for local imports -E debug symbol export -I directory add directory to import search path -K debug missing line numbers -N disable optimizations -S print assembly listing -V print compiler version -W debug parse tree after type checking -asmhdr file write assembly header to file -bench file append benchmark times to file -buildid id record id as the build id in the export metadata -complete compiling complete package (no C or assembly) -cpuprofile file write cpu profile to file -d list print debug information about items in list -dynlink support references to Go symbols defined in other shared libraries -e no limit on number of errors reported -f debug stack frames -h halt on error -i debug line number stack -importmap definition add definition of the form source=actual to import map -installsuffix suffix set pkg directory suffix -j debug runtime-initialized variables -l disable inlining -largemodel generate code that assumes a large memory model -linkobj file write linker-specific object to file -live debug liveness analysis -m print optimization decisions -memprofile file write memory profile to file -memprofilerate rate set runtime.MemProfileRate to rate -msan build code compatible with C/C++ memory sanitizer -nolocalimports reject local (relative) imports -o file write output to file -p path set expected package import path -pack write package file instead of object file -r debug generated wrappers -race enable race detector -s warn about composite literals that can be simplified -shared generate code that can be linked into a shared library -traceprofile file write an execution trace to file -trimpath prefix remove prefix from recorded source file paths -u reject unsafe code -v increase debug verbosity -w debug type checking -wb enable write barrier (default true) go tool asm: exit status 2 flag provided but not defined: -V usage: asm [options] file.s ... Flags: -D value predefined symbol with optional simple value -D=identifier=value; can be set multiple times -I value include directory; can be set multiple times -S print assembly and machine code -debug dump instructions as they are parsed -dynlink support references to Go symbols defined in other shared libraries -e no limit on number of errors reported -o string output file; default foo.o for /a/b/c/foo.s as first argument -shared generate code that can be linked into a shared library -trimpath string remove prefix from recorded source file paths

还是一样的呢 亲

lee_
lee_ · #5 · 7年之前
hunterhug
hunterhug · #6 · 7年之前

你这就很过分了,居然不加一个小点点:import . "fmt"

clever_mike
clever_mike · #7 · 7年之前
hunterhughunterhug #6 回复

你这就很过分了,居然不加一个小点点:import . "fmt"

import后面需要加 点吗? 我看书上没说要加点额。。

clever_mike
clever_mike · #8 · 7年之前
lee_lee_ #5 回复

重装下试试?: https://github.com/golang/go/issues/21646 确保不存在通过多种途径安装Golang的情况: https://stackoverflow.com/questions/46241177/in-gogland-i-get-flag-provided-but-not-defined-goversion-using-go-run?rq=1

谢谢,我看看

hunterhug
hunterhug · #9 · 7年之前
clever_mikeclever_mike #7 回复

#6楼 @hunterhug import后面需要加 点吗? 我看书上没说要加点额。。

你可以试下,又不会有什么问题

clever_mike
clever_mike · #10 · 7年之前
hunterhughunterhug #6 回复

你这就很过分了,居然不加一个小点点:import . "fmt"

按照你的说法 加了点 也没有用呢

clever_mike
clever_mike · #11 · 7年之前
lee_lee_ #5 回复

重装下试试?: https://github.com/golang/go/issues/21646 确保不存在通过多种途径安装Golang的情况: https://stackoverflow.com/questions/46241177/in-gogland-i-get-flag-provided-but-not-defined-goversion-using-go-run?rq=1

谢谢!!我把GO全部删完了 重新装了个 GO 就可以了,么么哒

lee_
lee_ · #12 · 7年之前
clever_mikeclever_mike #11 回复

#5楼 @lee_ 谢谢!!我把GO全部删完了 重新装了个 GO 就可以了,么么哒

不客气~~

添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传