Use go Makefiles
This commit is contained in:
parent
f9ea765794
commit
841757090b
33
Makefile
33
Makefile
@ -1,31 +1,6 @@
|
||||
include $(GOROOT)/src/Make.$(GOARCH)
|
||||
|
||||
TARG=irc
|
||||
GOFILES=irc.go irc_struct.go
|
||||
|
||||
all: $(GOARCH)
|
||||
|
||||
clean: clean_$(GOARCH)
|
||||
rm test
|
||||
|
||||
386:
|
||||
8g $(GOFILES)
|
||||
8g test.go
|
||||
8l -o test test.8
|
||||
|
||||
amd64:
|
||||
6g $(GOFILES)
|
||||
6g test.go
|
||||
6l -o test test.6
|
||||
|
||||
arm:
|
||||
5g $(GOFILES)
|
||||
5g test.go
|
||||
5l -o test test.5
|
||||
|
||||
clean_amd64:
|
||||
rm *.6
|
||||
|
||||
clean_386:
|
||||
rm *.8
|
||||
|
||||
clean_arm:
|
||||
rm *.5
|
||||
|
||||
include $(GOROOT)/src/Make.pkg
|
||||
|
15
README.markdown
Normal file
15
README.markdown
Normal file
@ -0,0 +1,15 @@
|
||||
Description
|
||||
----------
|
||||
|
||||
Event based irc client library.
|
||||
|
||||
Install
|
||||
----------
|
||||
$ git clone git@github.com:thoj/Go-IRC-Client-Library.git
|
||||
$ cd Go-IRC-Client-Library
|
||||
$ make
|
||||
$ make install
|
||||
|
||||
Example
|
||||
----------
|
||||
See example/test.go
|
26
example/Makefile
Normal file
26
example/Makefile
Normal 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"./irc";
|
||||
"irc";
|
||||
"fmt";
|
||||
"os";
|
||||
)
|
10
irc.go
10
irc.go
@ -19,8 +19,8 @@ func reader(irc *IRCConnection) {
|
||||
for {
|
||||
msg, err := br.ReadString('\n');
|
||||
if err != nil {
|
||||
fmt.Printf("%s\n", err);
|
||||
irc.perror <- err;
|
||||
return;
|
||||
}
|
||||
irc.pread <- msg;
|
||||
}
|
||||
@ -31,7 +31,8 @@ func writer(irc *IRCConnection) {
|
||||
b := strings.Bytes(<-irc.pwrite);
|
||||
_, err := irc.socket.Write(b);
|
||||
if err != nil {
|
||||
irc.perror <- err
|
||||
fmt.Printf("%s\n", err);
|
||||
irc.perror <- err;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -149,8 +150,6 @@ func (irc *IRCConnection) handle_command(msg string) *IRCEvent {
|
||||
e.Code = IRC_PING;
|
||||
e.Message = matches[2];
|
||||
e.Error = os.ErrorString(matches[2]);
|
||||
;
|
||||
irc.perror <- e.Error;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
@ -179,6 +178,7 @@ func handler(irc *IRCConnection) {
|
||||
|
||||
irc.EventChan <- e;
|
||||
case error := <-irc.perror:
|
||||
fmt.Printf("Piped error: %s\n", error);
|
||||
ee := new(IRCEvent);
|
||||
ee.Error = error;
|
||||
ee.Code = ERROR;
|
||||
@ -209,7 +209,7 @@ func IRC(server string, nick string, user string, events chan *IRCEvent) (*IRCCo
|
||||
irc.registered = false;
|
||||
irc.pread = make(chan string, 100);
|
||||
irc.pwrite = make(chan string, 100);
|
||||
irc.perror = make(chan os.Error);
|
||||
irc.perror = make(chan os.Error, 10);
|
||||
irc.EventChan = events;
|
||||
irc.nick = nick;
|
||||
irc.user = user;
|
||||
|
Loading…
Reference in New Issue
Block a user