[go-nuts] marshal and unmarshal

2017-11-18 Thread 2891132love
I write the program in the .txt.The purpose of this progaram is to marshal the structure,unmarshal it and output some result.But I can't output the marshal result and there are some errors exist .How to solve it??Thank you for reading. -- You received this message because you are subs

Re: [go-nuts] fetching URLs Concurrently

2017-11-14 Thread 2891132love
Thank you for helping me.The other question is: if I only change fetch function,how to make the same result?? 在 2017年11月13日星期一 UTC+8下午9:08:00,Ayan George写道: > > > > On 11/13/2017 04:10 AM, 28911...@gmail.com wrote: > > > for range os.Args[1:] { > > fmt.Println(<-ch) > > }

[go-nuts] fetching URLs Concurrently

2017-11-13 Thread 2891132love
I try writing the program and run it. the program is as following: package main import ( "fmt" "io" "io/ioutil" "net/http" "os" "time" ) func main() { start := time.Now() ch := make(chan string) for _, url := range os.Args[1:] { go fetch(url, ch)

Re: [go-nuts] Re: network programming about go

2017-11-12 Thread 2891132love
I know your meaning.But I still can't get the result I want. this is the server program: package main import ( "fmt" "net" "os" "strings" ) func main() { listener, err := net.Listen("tcp", "0.0.0.0:400") checkError(err) for i := 0; i < 10; i++ { conn, err := listener.Accept() if err != nil { co

Re: [go-nuts] Re: network programming about go

2017-11-12 Thread 2891132love
So how to modify my program correctly??I try to add read in different place but it still can't get the result I want. 在 2017年11月12日星期日 UTC+8上午5:05:49,Justin Israel写道: > > > > On Sun, Nov 12, 2017, 10:03 AM Justin Israel > wrote: > >> >> >> On Sat, Nov 11, 2017, 9:55 PM <28911...@gmail.com > wrot

[go-nuts] Re: network programming about go

2017-11-11 Thread 2891132love
this is the server program: > package main > > import ( > "fmt" > "net" > "os" > "strings" > ) > > func main() { > > listener, err := net.Listen("tcp", "0.0.0.0:400") > checkError(err) > for i := 0; i < 10; i++ { > conn, err := listener.Accept() > if err != nil { > continue > } > handleClient(co

Re: [go-nuts] network programming about go

2017-11-10 Thread 2891132love
I try to change the IP address and close the software related,but it sometimes still can't run sucessfully.Sometimes it can run parts of the result I hope to see.It shows that the client can connect with the server but the server can't connect the client and get the message. 在 2017年11月7日星期二 UTC

Re: [go-nuts] network programming about go

2017-11-06 Thread 2891132love
I try to modify the program,but the result is: host:portfatal error: dial tcp 192.168.153.239:5000: connectex: No connection could be made because the target machine actively refused it.exit status 1.How to solve it?? 在 2017年11月6日星期一 UTC+8下午5:08:26,rog写道: > On 30 October 2017 at 06:55, <28911.

[go-nuts] input and output about go

2017-11-06 Thread 2891132love
I am a beginning learner.there is a simple question about go,the program is in the following: package main import ( "bufio" "fmt" "os" ) func main() { counts := make(map[string]int) input := bufio.NewScanner(os.Stdin) for input.Scan() { counts[input.Text()]++ } for line, n := range

[go-nuts] Re: network programming about go

2017-11-05 Thread 2891132love
Sorry, the last program is about server.and the following program is about the client: package main import ( "fmt" "net" "os" ) func main() { var buf [512]byte if len(os.Args) != 2 { fmt.Fprintf(os.Stderr, "usage:%s host:port", os.Args[0]) } service := os.Args[1] tcpAddr, err :

[go-nuts] Re: concurrency programing about go

2017-11-04 Thread 2891132love
Thank you very much.Sorry I still have some question:what's the function of wg? what does the sentense "wg.Add(2) " mean?? I found that if I change 2 into 1,the result is differnet. 在 2017年11月3日星期五 UTC+8上午4:45:47,snmed写道: > > Hi > > Here is the code: > > Version 1: > package main > > import ( >

[go-nuts] Re: concurrency programing about go

2017-11-02 Thread 2891132love
Sorry,I try my best to open the website but it can't work.Can you write it ??Thank you so much. 在 2017年10月30日星期一 UTC+8下午4:29:44,snmed写道: > > Hi > > There are several ways to solve it, here are two of them: > > https://play.golang.org/p/wJwkI7HQwv > https://play.golang.org/p/nasUcgBeG4 > > I prefe

[go-nuts] Re: network programming about go

2017-11-02 Thread 2891132love
who can solve this problem? 在 2017年10月30日星期一 UTC+8下午2:55:27,28911...@gmail.com写道: > > I write this code in the follwings: > package main > > import ( > "fmt" > "net" > "os" > ) > > func main() { > service := ":5000" > tcpAddr, err := net.ResolveTCPAddr("tcp", service) > checkError(err) > listener,

[go-nuts] network programming about go

2017-10-29 Thread 2891132love
I write this code in the follwings: package main import ( "fmt" "net" "os" ) func main() { service := ":5000" tcpAddr, err := net.ResolveTCPAddr("tcp", service) checkError(err) listener, err := net.ListenTCP("tcp", tcpAddr) checkError(err) for i := 0; i < 10; i++ { conn, err := listener.Accept()

[go-nuts] Re: concurrency programing about go

2017-10-29 Thread 2891132love
Yes, you're right.So how to solve it?? 在 2017年10月30日星期一 UTC+8下午12:37:49,Dave Cheney写道: > > Hello. I’m guessing that your tried calling twoprint(), but you’ve > probably found that nothing is printed to the screen before your program > exits. > > Is that correct? -- You received this message b

[go-nuts] concurrency programing about go

2017-10-29 Thread 2891132love
I write some function and other things in the followings: var a string var once sync.Once func setup() { a = "hello,world" } func doprint() { once.Do(setup) fmt.Print(a) } func twoprint() { go doprint() go doprint() } the quwstion is how can I make use of function twoprint()?? Thank you

Re: [go-nuts] a bug about go language

2017-10-26 Thread 2891132love
在 2017年10月25日星期三 UTC+8上午2:35:52,Justin Israel写道: > > > > On Wed, Oct 25, 2017, 2:56 AM Ian Lance Taylor > wrote: > >> On Tue, Oct 24, 2017 at 5:18 AM, <28911...@gmail.com > >> wrote: >> > >> > So how to modify it? I don't know clearly.Would you mind helping ,me to >> > solve this problem? >> >

Re: [go-nuts] a bug about go language

2017-10-26 Thread 2891132love
I try to do this: go run chapter11.2.go 127.0.0.1 and the program runs successfullly.Thank you so much.But I don't know why.Other prgrams don't need to add 127.0.0.1,what"s the principle? 在 2017年10月24日星期二 UTC+8下午9:57:03,Ian Lance Taylor写道: > > On Tue, Oct 24, 2017 at 5:18 AM, <28911...@gmail.com

Re: [go-nuts] a bug about go language

2017-10-26 Thread 2891132love
I try to do tis:go run chapter11.2.go 127.0.0.1 and the program runs sucessfully.Thank you so much.But I don't know why. Other program don't nedd to add 127.0.0,1,.What's the principle of it? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To u

Re: [go-nuts] a bug about go language

2017-10-24 Thread 2891132love
So how to modify it? I don't know clearly.Would you mind helping ,me to solve this problem? 在 2017年10月24日星期二 UTC+8下午3:06:00,Dave Cheney写道: > > The program you are trying to run requires an argument, an ip address > > On Tuesday, 24 October 2017 18:03:00 UTC+11, 28911...@gmail.com wrote: >> >> Sor

Re: [go-nuts] a bug about go language

2017-10-24 Thread 2891132love
Sorry.I see the bug in Sublime Text3 and I can't find the errors.At the sane time, I can't solve this problem.It's strange but it can run other programmings. 在 2017年10月23日星期一 UTC+8下午11:28:20,Jan Mercl写道: > > On Mon, Oct 23, 2017 at 5:23 PM <28911...@gmail.com > wrote: > > what bug do you see and

[go-nuts] a bug about go language

2017-10-23 Thread 2891132love