How to use `go test`?

42 views
Skip to first unread message

peng...@gmail.com

unread,
Jan 18, 2018, 11:01:22 AM1/18/18
to golang-nuts
Hi, I would like to use go test. But I am not sure how to use it.

Could you anybody provide me with a minimal working example how to use go test? Thanks.

$ cat main_test.go
#!/usr/bin/env gorun
// vim: set noexpandtab tabstop=2:

package foo

import (
    "testing"
)

func TestSomething(t *testing.T) {
    t.Fail()
}
$ go test -v
can't load package: package .:
main_test.go:1:1: illegal character U+0023 '#'

Jan Mercl

unread,
Jan 18, 2018, 11:08:21 AM1/18/18
to peng...@gmail.com, golang-nuts
On Thu, Jan 18, 2018 at 5:01 PM <peng...@gmail.com> wrote:

> main_test.go:1:1: illegal character U+0023 '#' 

The message says it all. Go is not an interpreted scripting language supporting #-style comments like bash, Python etc.




--

-j

Reply all
Reply to author
Forward
0 new messages