Skip to content

Instantly share code, notes, and snippets.

@wenLiangcan

wenLiangcan/gofmt error

Last active Jan 3, 2016
Embed
What would you like to do?
//测试代码
package test
import "fmt"
func main()
{
fmt.Printf("test\n")
}
//执行
$ gofmt -w test.go
test.go:6:1: expected declaration, found '{'
//然后源文件并没有被修正,请问是什么原因呢?
@kalenderApp

This comment has been minimized.

Copy link

@kalenderApp kalenderApp commented Jan 15, 2014

貌似首先要保证你写的语法正确吧?

@wenLiangcan

This comment has been minimized.

Copy link
Owner Author

@wenLiangcan wenLiangcan commented Jan 15, 2014

添加了 import 还是不行

@patricksuo

This comment has been minimized.

Copy link

@patricksuo patricksuo commented Jan 15, 2014

package test

import "fmt"

func main() {
        fmt.Printf("test\n")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.