remote module specification

This commit is contained in:
Greg Gauthier 2021-03-10 09:13:54 +00:00
parent 4da23b9537
commit 6b03f23916
3 changed files with 56 additions and 1 deletions

27
go-testing.go Normal file
View File

@ -0,0 +1,27 @@
package main
import (
"math"
"os"
"testing"
)
//TestAbs comment needed
func TestAbs(t *testing.T) {
// TestAbs comment
got := math.Abs(-1)
if got != 1 {
t.Errorf("Abs(-1) = %d; want 1", got)
}
}
//TestMain comment needed
func TestMain(m *testing.M) {
// call flag.Parse() here if TestMain uses flags
os.Exit(m.Run())
}
func main() {
TestAbs(&testing.T{})
}

2
go.mod
View File

@ -1,4 +1,4 @@
module go-learn
module bitbucket.org/gmgauthier_ecs/go-learn
go 1.16

28
goroutines.go Normal file
View File

@ -0,0 +1,28 @@
package main
import (
"fmt"
"time"
)
func f(from string) {
for i := 0; i < 3; i++ {
fmt.Println(from, ":", i)
}
}
func main() {
f("direct FIRST")
go f("goroutine one SECOND")
go f("goroutine two THIRD")
go func(msg string) {
fmt.Println(msg + " <IN MAIN> ")
go f("goroutine three <IN MAIN> FOURTH")
}("going")
time.Sleep(time.Second)
fmt.Println("done")
}