Use go Makefiles

This commit is contained in:
tj
2009-11-22 00:05:12 +01:00
parent f9ea765794
commit 841757090b
6 changed files with 51 additions and 36 deletions

26
example/Makefile Normal file
View File

@@ -0,0 +1,26 @@
all: $(GOARCH)
clean: clean_$(GOARCH)
rm test
386:
8g test.go
8l -o test test.8
amd64:
6g test.go
6l -o test test.6
arm:
5g test.go
5l -o test test.5
clean_amd64:
rm *.6
clean_386:
rm *.8
clean_arm:
rm *.5

44
example/test.go Normal file
View File

@@ -0,0 +1,44 @@
package main
import (
"irc";
"fmt";
"os";
)
func main() {
events := make(chan *irc.IRCEvent, 100);
irccon, err := irc.IRC("irc.efnet.net:6667", "testgo", "testgo", events);
if err != nil {
fmt.Printf("%s\n", err);
fmt.Printf("%#v\n", irccon);
os.Exit(1);
}
for {
event := <-events;
/* switch event.Code {
case UNKNOWN:
fmt.Printf("%#v\n", event)
case 0:
fmt.Printf("%#v\n", event)
case IRC_PRIVMSG:
fmt.Printf("%#v\n", event)
case IRC_CHAN_TOPIC:
fmt.Printf("%#v\n", event)
case IRC_CHAN_MODE:
fmt.Printf("%#v\n", event)
case IRC_ACTION:
fmt.Printf("%#v\n", event)
case IRC_WELCOME:
irc.Join("#ggpre")
}*/
if event.Code == irc.IRC_WELCOME {
irccon.Join("#gotestchan")
} else if event.Code == irc.IRC_PRIVMSG {
if event.Message == "!test" {
irccon.Privmsg(event.Target, "Whatever man!");
}
}
fmt.Printf("%#v\n", event);
}
}