Re: [go-nuts] Are you tired typing if err != nil {} ?

2017-09-14 Thread Jan Mercl
On Fri, Sep 15, 2017 at 2:32 AM Wojciech S. Czarnecki wrote: I code a lot in Go, but saving a couple of seconds/minutes when writing code which, including research, thinking, testing, debugging and documenting, takes hours or even months to develop makes no sense to me. Vim is

[go-nuts] Re: Bytconv where art thou

2017-09-14 Thread as
Strings are immutable, slices arent. Doesnt this make a string the optimal read only data structure for storing and passing around a run of bytes? If there is performance data, please share. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] Remove GOPATH from binary

2017-09-14 Thread Chandru
How do I remove the actual value of GOPATH from executable binary? I tried the following command, but my home directory continued to appear when I ran strings on the binary. go install -gcflags -trimpath=$GOPATH -asmflags -trimpath=$GOPATH -- Chandra Sekar.S -- You received this message

[go-nuts] Re: how to sort http.Header by ourselves

2017-09-14 Thread Chengbin Du
*the reason is that *akamai rejects requests with 403 if Accept is after User-Agent. So i would like to know how to order the request header fields. here is the post, https://gwillem.gitlab.io/2017/05/02/http-header-order-is-important/ *I'm very glad if you can give me some advice.*

[go-nuts] Re: Retrieve Unknown Rows & Columns From a MySQL Table (Golang)

2017-09-14 Thread Alexandre K
So this appears to be working. But I believe something needs to be converted into strings. This is what the code is returning: user@server:~/folder/~# go run query.go [50] [99 97 116] [49] [100 111 103] [52] [108 97 120] [54] [111 115 116 114 105 99 104] [51] [112 101 110 103 117 105 110] [53]

[go-nuts] Re: Retrieve Unknown Rows & Columns From a MySQL Table (Golang)

2017-09-14 Thread Alexandre K
So, this appears to be working...However, something isn't being converted into a string. The code is returning the following values. [50] [99 97 116] [49] [100 111 103] [52] [108 97 120] [54] [111 115 116 114 105 99 104] [51] [112 101 110 103 117 105 110] [53] [119 104 97 108 101] On

[go-nuts] Re: Retrieve Unknown Rows & Columns From a MySQL Table (Golang)

2017-09-14 Thread djadala
Again not tested: package main import ( "database/sql" "fmt" "log" _ "github.com/go-sql-driver/mysql" ) func main() { //Connect to database and check for errors db, err := sql.Open("mysql",

Re: [go-nuts] Re: Retrieve Unknown Rows & Columns From a MySQL Table (Golang)

2017-09-14 Thread Steven Hartland
QueryRow(..) returns a *Row but you then chained a .Scan(..) which returns an error as compile error suggests. I'm guessing you want rows, if so have a look at: https://golang.org/pkg/database/sql/#DB.Query On 15/09/2017 03:10, Alexandre K wrote: Thank you so much for your response! The code

[go-nuts] Re: Retrieve Unknown Rows & Columns From a MySQL Table (Golang)

2017-09-14 Thread Alexandre K
Thank you so much for your response! The code you added probably works, but I'm getting held up by something else. I'm running into a set of errors when I execute this on the command line...It seems the "rows" value I'm creating doesn't have the functionality that the guide says it would

[go-nuts] Re: Retrieve Unknown Rows & Columns From a MySQL Table (Golang)

2017-09-14 Thread djadala
Hi, something like (not tested): package main import ( "database/sql" "fmt" "log" _ "github.com/go-sql-driver/mysql" ) func main() { //Connect to database and check for errors db, err := sql.Open("mysql",

Re: [go-nuts] Re: Choosing a framework

2017-09-14 Thread Vikram Rawat
Thanks for the tip! But he is a newcomer and so am I. Tell us can we learn it. Is it documented anywhere. That's exactly what i told him. I would love to try vecty. But right now we can't figure out how to try it. 14-09-2017 9:14 pm को "Jim Ancona" ने लिखा: > On Thu, Sep

[go-nuts] Do you check in vendor packages?

2017-09-14 Thread Kevin Malachowski
I generally vote for checking in, or at least ensuring that /something/ has an in-house copy of all dependencies. The worst thing that can happen is someone deleting their repository and having your project being super broken. (See also

[go-nuts] Are you tired typing if err != nil {} ?

2017-09-14 Thread Wojciech S. Czarnecki
Today I discussed wonders of explicit failure handling in Go with a young trainee and once again I heard »it is so much typing over and over«. An argument I never really understood because I use vim so any repeatable thing soon ends under ab or in snippets directory. Something pico editor likely

[go-nuts] Retrieve Unknown Rows & Columns From a MySQL Table (Golang)

2017-09-14 Thread Alexandre K
Hello Everyone, I'm new to Golang and I am trying to figure out how to retrieve multiple unknown columns and rows from a table. I have an example table called ANIMALS . I am trying to follow the example at the bottom of this

[go-nuts] Re: panic in CBCDecrypter

2017-09-14 Thread mikemndy
The documentation could be better (and, in fact it appears to be much improved in tip thanks to Filippo), but there are only two situations in which CryptBlocks will panic: 1. len(src) > len(dst) 2. len(src)%BlockSize() != 0 Arguably it should also panic if src and dst destructively overlap,

[go-nuts] Re: bufio.Writer and timeouts

2017-09-14 Thread Juliusz Chroboczek
> Hmm maybe I misunderstood your use case. I thought you were basically > setting a fixed write duration via SetWriteDeadline() before each Write() > call, in which case the same treatment probably should be done for Flush(). I'm already doing that. -- You received this message because you are

Re: [go-nuts] Re: bufio.Writer and timeouts

2017-09-14 Thread Sangjin Lee
Hmm maybe I misunderstood your use case. I thought you were basically setting a fixed write duration via SetWriteDeadline() before each Write() call, in which case the same treatment probably should be done for Flush(). Sangjin On Thu, Sep 14, 2017 at 3:33 PM, Juliusz Chroboczek

[go-nuts] Re: bufio.Writer and timeouts

2017-09-14 Thread Juliusz Chroboczek
> Is extending the deadline right before flushing an option? No. Before the Flush (or the Write) times out, I don't know that this particular peer is congested, and hence I have no reason to reschedule requests queued to this peer on a different connection. -- Juliusz -- You received this

[go-nuts] Do you check in vendor packages?

2017-09-14 Thread Will Faught
According to https://github.com/golang/dep/blob/master/docs/FAQ.md#should-i-commit-my-vendor-directory, the pros and cons are: Pros: - Only way to get truly reproducible builds - Don't need to `dep ensure` (or whatever your tool is) every time you check out or merge/pull Cons: - PR vendor

[go-nuts] Re: Using dep tool behind proxy with mix of internal/external deps

2017-09-14 Thread Justin Israel
Where are people having discussions about the dep tool these days? I've gotten no reply on the github issue thread, nor on this forum. Is there a slack or something dedicated to this? On Wed, Sep 6, 2017, 9:26 AM Justin Israel wrote: > I asked this on a relevant dep tool

Re: [go-nuts] Re: "html/dom" alternative to html/template for true separation of concerns?

2017-09-14 Thread Marvin Renich
* Karv Prime [170914 13:16]: > I wouldn't agree on "there is not even a need for the wrapper" part. > If the HTML tags are produced entirely by code, it comes with its own > issues - suddenly there is a thing that wasn't in the markup - it would > probably reduce

Re: [go-nuts] Go trademark guidelines

2017-09-14 Thread Ian Lance Taylor
On Thu, Sep 14, 2017 at 11:26 AM, Norbert Fuhs wrote: > > I would like to know if I mention Go in public programming guide / handbook > along with the Gopher mascot > I have to follow other trademark rules then this mention in the official Go > FAQ:

[go-nuts] Go trademark guidelines

2017-09-14 Thread Norbert Fuhs
Hi, I would like to know if I mention Go in public programming guide / handbook along with the Gopher mascot I have to follow other trademark rules then this mention in the official Go FAQ: https://golang.org/doc/faq#Whats_the_origin_of_the_mascot ?

Re: [go-nuts] Re: "html/dom" alternative to html/template for true separation of concerns?

2017-09-14 Thread Karv Prime
@Andy Balholm: Perfect. I've seen some other template engines where that didn't happen at all and the artifacts stayed. @Marvin Renich: Yet tags, classes and ids are HTML standard syntax and used for styling and scripting purposes. {{[...]}} is only a placeholder. It makes no difference per

Re: [go-nuts] Re: "html/dom" alternative to html/template for true separation of concerns?

2017-09-14 Thread Karv Prime
@Andy Balholm: Perfect. I've seen some other template engines where that didn't happen at all and the artifacts stayed. @Marvin Renich: Yet tags, classes and ids are HTML standard syntax and used for styling and scripting purposes. {{[...]}} is only a placeholder. It makes no difference per

[go-nuts] how to sort http.Header by ourselves

2017-09-14 Thread Chengbin Du
Hi Guys, Is there any way to change the sorter of the http.Header except fork the whole Golang http package? https://github.com/golang/go/blob/master/src/net/http/header.go#L114 thank you so much, I look forward to hearing from you! -- You received this message because you are subscribed to

Re: [go-nuts] Timestamp issues

2017-09-14 Thread Marvin Renich
* dr.ink [170914 10:26]: > Hello, I have an issue with generating timestamps in golang, this is how my > app works. First the app generates the timestamp like this > > timestamp := time.Now().UTC().Add(time.Second * > time.Duration(settings.TimeToLive)).Unix() > > this

Re: [go-nuts] Re: "html/dom" alternative to html/template for true separation of concerns?

2017-09-14 Thread Marvin Renich
* Karv Prime [170914 11:14]: > ... - yet > there's the disadvantage of the need to put artifacts into the markup which > then get replaced by the wanted content You have to do that anyway, you just use different artifacts. Each location where a substitution will occur

Re: [go-nuts] Re: Choosing a framework

2017-09-14 Thread Jim Ancona
On Thu, Sep 14, 2017 at 1:28 AM, Vikram Rawat wrote: > > And there is another project called VECTY. But I mailed them and they told > me it's not documented yet. and it could have bugs. > Vecty (https://github.com/gopherjs/vecty) uses Gopherjs and runs in the browser, so

Re: [go-nuts] "html/dom" alternative to html/template for true separation of concerns?

2017-09-14 Thread Andy Balholm
The placeholders never show up in template output. If the data is missing, the placeholders normally just disappear; in some cases there might be an error, depending on exactly what type of “missing.” Andy > On Sep 14, 2017, at 8:14 AM, Karv Prime wrote: > > As it would

Re: [go-nuts] Re: How to run escape analysis on subpackage

2017-09-14 Thread Diego Medina
Thanks James! I'm glad I posted the msg, and you are right, I edited the file and then passing the package name printed info. I had done $go clean hoping that was enough, but I guess that wasn't enough to clean all the precompile code. Thanks Diego On Thu, Sep 14, 2017 at 11:15 AM, James

[go-nuts] Re: How to run escape analysis on subpackage

2017-09-14 Thread James Bardin
On Thursday, September 14, 2017 at 10:58:27 AM UTC-4, Diego Medina wrote: > > > go build -gcflags "-m -m" github.com/me/project-name/packagea and nothing > prints out, > > > Nothing printed because it was already installed. You could update the timestamp on any of the package files, remove

[go-nuts] Re: "html/dom" alternative to html/template for true separation of concerns?

2017-09-14 Thread Karv Prime
As it would get a little bit confusing if I'd reply to everyone with a single post, I'll answer in a single post. I hope you don't mind. At least now it's past 16:00 and not past 04:00 and I have a clearer mind. ^^ @Egon: I've read the whole article - yes, many coders sadly do forget about

[go-nuts] How to run escape analysis on subpackage

2017-09-14 Thread Diego Medina
Hi, I have a project with a package main and then a few other packages inside it, something like: $GOPATH//src/github.com/me/project-name $GOPATH//src/github.com/me/project-name/packagea $GOPATH//src/github.com/me/project-name/packageb if I run go build -gcflags "-m -m" at

Re: [go-nuts] "html/dom" alternative to html/template for true separation of concerns?

2017-09-14 Thread Marvin Renich
* Karv Prime [170913 22:01]: > It = html/template > "The purpose" = the one I thought I could use it for and described above. I'm still not sure you understand the capabilities of html/template. This playground snippet might help you: https://play.golang.org/p/_1KSiZbwh-

[go-nuts] panic in CBCDecrypter

2017-09-14 Thread Johnny Luo
Hello Gophers, I have wrote some encryption and decryption code recently and find out in cbcDecrypter , and cbcEncrypter provided by runtime, it panic instead of return error, thus I need to used defer to recover from the panic , if it ever happens The question is why it is implement in

Re: [go-nuts] "html/dom" alternative to html/template for true separation of concerns?

2017-09-14 Thread Andy Balholm
I still don’t understand why automatic escaping makes html/template impractical for the purpose you were describing. Is it because the blog post would be HTML rather than plain text? In that case, you would need to convert it to the template.HTML type before passing it to the template, and it

[go-nuts] Memory Benchmarking

2017-09-14 Thread Chris Hopkins
Hi, I've got a reasonably performance critical piece of code that I'm trying to profile and I suspect is being limited by the number of memory allocations I am doing. I understand a good tool is: go test -c . -gcflags='-m' Which gives some very useful results. However I haven't found any real

[go-nuts] Re: Go at Vimeo in NYC!

2017-09-14 Thread Vladimir Varankin
Do you consider applications from continents other than the US? On Wednesday, September 13, 2017 at 7:45:11 PM UTC+3, gabr...@vimeo.com wrote: > > We have lots of jobs programming in Go at Vimeo's headquarters in NYC! > Please reach out to me at gabr...@vimeo.com if you or > anyone you know