Created
January 12, 2011 08:56
-
-
Save border/775899 to your computer and use it in GitHub Desktop.
Go Programming Language Package Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package filestuts | |
type File struct { | |
Fd int | |
Name string | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include $(GOROOT)/src/Make.inc | |
all: | |
$(GC) numbers.go | |
$(GC) filestuts.go | |
$(GC) test.go | |
$(LD) -o test.out test.$O | |
clean: | |
rm -rf *.6 *.8 *.o *.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package numbers | |
func Double(i int) int { | |
return i * 2 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"./numbers" | |
"./filestuts" | |
"fmt" | |
) | |
func main() { | |
ret := numbers.Double(10) | |
fmt.Println(ret) | |
file := &filestuts.File{1, "String"} | |
fmt.Printf("%v\n", file) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment