[go-nuts] Serialized HTTP requests with asynchronous responses

2017-09-25 Thread Donovan Hide
Hi, I have an interesting problem where I need to make a rapid series of HTTP requests to the same host, each with a nonce which increments with each request and a signature of the request body including that nonce, but I don't want to wait for the response before sending the next request. The

[go-nuts] Re: Example output not visible in godoc

2017-09-25 Thread snmed
Hi all I found the problem, but i'm not sure if it's a bug or not. If i move the type and function declarations to a different file, it works as it should. But as described here: https://blog.golang.org/examples it should be possible to use own types

Re: [go-nuts] Re: Simple web crawler question. How to avoid crawling visited links?

2017-09-25 Thread Aaron
Thank you Mike. I have read the book and done that exercise. The code in the example will not crawl into certain depth and stop at certain depth of the website. The requirements are a bit different. I can't just use the approach in the example directly or more precisely I don't know how to use

[go-nuts] gomobile iOS reverse bindings

2017-09-25 Thread aronzvi
I would like to develop a go application for iOS and will need to call platform APIs (objc) from the go application. I have come across gomobile and its reverse bindings feature which appears to suit my needs. I have looked at and built the android reverse example using the gradle gobind

[go-nuts] Re: Simple web crawler question. How to avoid crawling visited links?

2017-09-25 Thread Aaron
Wow this has everything for a crawler plus many more. Is it good to put the code into so many files? I thought go program is simple enough to put most code into one file. But I think if code reuse is the main concern maybe this is good. On Monday, September 25, 2017 at 10:44:45 PM UTC+8, Tim T

Re: [go-nuts] How to remove a struct value from a struct slice without memory leak?

2017-09-25 Thread Aaron
Thanks I also worried that at the beginning. But when I use this code I find it works correctly. But if I pull it out to test the individual function it doesn't look good. I think you are right the best practice is to return the slice. For the connInfo struct comparison I learned that

Re: [go-nuts] How to remove a struct value from a struct slice without memory leak?

2017-09-25 Thread Dan Kortschak
Just to clarify, this is from context discussing Aaron's code. On Mon, 2017-09-25 at 17:38 -0700, 'Keith Randall' via golang-nuts wrote: > I see a couple of issues with your code. >  > On Monday, September 25, 2017 at 5:14:22 PM UTC-7, kortschak wrote: > >  -- You received this message because

Re: [go-nuts] How to remove a struct value from a struct slice without memory leak?

2017-09-25 Thread 'Keith Randall' via golang-nuts
I see a couple of issues with your code. The code you use for removal of an element is right. You've correctly made sure there is no leak. You never return the clients slice back to the caller. Any length shortening of the clients slice will be lost when the function returns. You might want

Re: [go-nuts] How to remove a struct value from a struct slice without memory leak?

2017-09-25 Thread Dan Kortschak
This is not nice if you want to reuse the slice, and still may leak the fields. clients[i] = clients[len(clients)-1] // If the current clients[i] is deleted it becomes inaccessible // and the ipAddr, name and conn fields potentially leak, so // zero them in the last position of the slice.

Re: [go-nuts] Re: Simple web crawler question. How to avoid crawling visited links?

2017-09-25 Thread Michael Jones
The book, The Go Programming Language discusses the web crawl task at several points through the text. The simplest complete parallel version is: https://github.com/adonovan/gopl.io/blob/master/ch8/crawl3/findlinks.go which if you'll download and build works quite nicely: *$ crawl3

[go-nuts] [ANN] go-resty v1.0 released - simple HTTP and REST client library

2017-09-25 Thread Jeevanandam M.
Stable Version : gopkg.in/resty.v1 Edge Version : github.com/go-resty/resty godoc : https://godoc.org/github.com/go-resty/resty *v1.0 Released* Resty first version released on Sep 15, 2015 then it grew gradually as a very handy and helpful library. Its been a two years; v1.0 released

[go-nuts] How to remove a struct value from a struct slice without memory leak?

2017-09-25 Thread Tamás Gulácsi
https://github.com/golang/go/wiki/SliceTricks clients[i] = clients[0] clients = clients[1:] -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[go-nuts] Re: Bytconv where art thou

2017-09-25 Thread Amnon Baron Cohen
https://github.com/golang/go/issues/2632 > >> -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit

[go-nuts] Docs for vendored packages?

2017-09-25 Thread Alex Buchanan
Does anyone have a strategy for accessing the docs (godoc) of vendored dependencies? I was a little surprised to find that godoc decided not to show vendored packages, here: https://github.com/golang/go/issues/13929 This also applies more generally than vendored deps. In the past, I have

Re: [go-nuts] Need help to figure out the problem in the Go Web crawler and scraper.

2017-09-25 Thread Shawn Milochik
Try profiling it: https://golang.org/pkg/net/http/pprof/ You can find all kinds of useful info there. The more specific question you can ask, the better help you'll get, and the more likely it is that someone will take the time to help. -- You received this message because you are subscribed

[go-nuts] Need help to figure out the problem in the Go Web crawler and scraper.

2017-09-25 Thread Yogesh Desai
Hello, everyone, I am trying to implement a web crawler and scrapper. Please check the link for my implementation. The code uses lots of memory and creates many goroutines until computer ran out of memory and code exits

Re: [go-nuts] Re: How to read multi-page TIFF image?

2017-09-25 Thread Jonathan Pittman
We have some ideas in common for sure (i.e. storing with upsin/camlistore and grabbing the embedded previews for display). Though, my needs go much further (i.e. being able to process my raw images with Go). I stick every RAW image from my D800 in Google Cloud Storage with the plan to eventually

[go-nuts] Re: Magefiles - a makefile replacement using go

2017-09-25 Thread Nate Finch
Additional note - just landde a change to support makefile style dependency trees. i.e. you can say x depnds on y and z, and z depends on y and Q, and all dependencies will be run exactly once, from leafs up to the root, and all in their own goroutines. And there's a #mage channel on gopher

Re: [go-nuts] Re: How to read multi-page TIFF image?

2017-09-25 Thread Guy Allard
The multi-page TIFs I have seen have multiple IFDs (a linked list). I do not know anything about SubIFds, have never seen such. Adding support for multiple IFDs to the go package being discussed seems not too difficult (reading the existing code). Suggest trying to contact the package

Re: [go-nuts] Re: How to read multi-page TIFF image?

2017-09-25 Thread Andrew O'Neill
I'm currently travelling with a Nikon D750. From what I can tell the raw images use a single IFD with 2 SubIFDs the main one being the embedded jpeg for the thumbnail and the second being the raw image data. If you have something to parse the raw image data that would be awesome. I've been

Re: [go-nuts] Re: Simple web crawler question. How to avoid crawling visited links?

2017-09-25 Thread Michael Jones
i suggest that you first make it work in the simple way and then make it concurrent. however, one lock-free concurrent way to think of this is as follows... 1. start with a list of urls (in code, on command line, etc.) 2. spawn a go process that writes each of them to a channel of strings,

[go-nuts] Re: How to remove a struct value from a struct slice without memory leak?

2017-09-25 Thread vitaly1961
clients = append(clients[:i], clients[i+1:len(clients)]...) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more

[go-nuts] Simple web crawler question. How to avoid crawling visited links?

2017-09-25 Thread Tim T
I did something similar for an interview some months ago. If you want to get some inspiration: https://github.com/TimTosi/crawlr -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it,

Re: [go-nuts] Re: How to read multi-page TIFF image?

2017-09-25 Thread Jonathan Pittman
Wether a multi-page TIFF uses multiple IFDs or uses one IFD with multiple SubIFDs is implementation dependent. Though, I think most probably just use multiple IFDs. The basic structure of an IFD and a SubIFD is essentially the same. The main difference is where you find their offsets and

[go-nuts] How to remove a struct value from a struct slice without memory leak?

2017-09-25 Thread Aaron
Newbie here everyone. I am trying to remove a struct value from a slice, which consists of elements of the same type. Let's say the type is defined as below: type connInfo struct { ipAddr string name string conn net.Conn } Now I have a remove function, in which there is a for loop

[go-nuts] Re: Simple web crawler question. How to avoid crawling visited links?

2017-09-25 Thread Aaron
I have come up with a fix, using Mutex. But I am not sure how to do it with channels. package main import ( "fmt" "log" "net/http" "os" "strings" "sync" "golang.org/x/net/html" ) var lock = sync.RWMutex{} func main() { if len(os.Args) != 2 {

[go-nuts] [Go2] cleanup deprecated code

2017-09-25 Thread Gert
Make sure you can track all deprecated code for Go2 for removal example https://golang.org/src/encoding/csv/reader.go#L109 `TrailingComma bool // ignored; here for backwards compatibility` Life is to short to wait another 10 years to fix things Thx --

Re: [go-nuts] Example output not visible in godoc

2017-09-25 Thread snmed
Thank you for your answer, but nope doesn't make any difference, at least not with local godoc instance. Am Montag, 25. September 2017 11:03:55 UTC+2 schrieb Jan Mercl: > > On Mon, Sep 25, 2017 at 10:55 AM snmed > wrote: > > > Has anyone an idea why it is no working

Re: [go-nuts] Example output not visible in godoc

2017-09-25 Thread Jan Mercl
On Mon, Sep 25, 2017 at 10:55 AM snmed wrote: > Has anyone an idea why it is no working correct? Blind shot: Try removing the final empty line:

[go-nuts] Example output not visible in godoc

2017-09-25 Thread snmed
Hi all I have some problem with my go examples, in some case the output is correct rendered in a code block, but for other examples it is not rendered in a separat code block. Here the link to the documentation of my package: https://godoc.org/bitbucket.org/snmed/sting For example GetService