[go-nuts] Re: generic "CRUD" handlers

2016-12-20 Thread brian
take a look at goa and gorma: https://goa.design goa generates an API from your description DSL, and Gorma generates the data access layer. It uses gorm under the scenes so you'll have an easy route to migration. Brian On Tuesday, December 20, 2016 at 8:46:12 AM UTC-5, Thomas Bellembois

[go-nuts] Just launched a new Go Community Site

2017-07-01 Thread brian
LinkLog to post Updates, New libraries and More. Feedback welcome http://golangflow.io/ -- 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.

[go-nuts] Is Go vulnerable to heap inspection attacks?

2023-05-07 Thread Brian
I haven't read anything that confirms/denies the existence of this possibility. Is it worth worrying about, and if so, what can be done to mitigate it? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop rec

[go-nuts] Re: Go += Package Versioning

2018-02-20 Thread Brian Slesinsky
I'm wondering how to respond to security patches. After a patch, any go.mod file mentioning an older version of the library is a candidate for version-bumping: download the new version, test, and do a commit with the new version number if all goes well. It's nice that it can be done in any orde

[go-nuts] Re: Flutter and golang

2018-03-10 Thread Brian Slesinsky
On Saturday, March 10, 2018 at 12:28:19 PM UTC-8, Ged Wed wrote: > > Flutter now runs on all desktops and mobiles officially. The desktop > version was announced 2 weeks ago and already Linux and macOS works, with > Windows probably being a few weeks away from what I guesstimate. > Could you ex

[go-nuts] GopherCon 2018 CFP Ends March 15, 2018 7:59pm EST

2018-03-14 Thread Brian Ketelsen
notified in mid-April. Submit online at papercall.io: https://www.papercall.io/gophercon2018 <https://www.papercall.io/gophercon2018> Thanks! Brian Ketelsen, Erik St. Martin - GopherCon Organizers Ashley McNamara - GopherCon 2018 Program Chair -- You received this message because y

Re: [go-nuts] Newbie question about struct definition

2018-12-03 Thread Brian Hatfield
ff/b373623a9572cf1a992486d2d87dcd85>. Good luck! Brian On Mon, Dec 3, 2018 at 10:01 PM Freddy Martinez wrote: > Hey guys, I’ve been learning Go for the lat couple of weeks but now that > I’m looking to more advanced topics, I’ve seen things like > > type Person struct { > FirstNam

Re: [go-nuts] Visual Studio Code oddity with Go

2019-02-21 Thread Brian Mcneely
On Thu, Feb 21, 2019, 9:42 PM andrey mirtchovski > I tried the solution posted by Andrey (Thank you!) and it still does the > popup thing. Oh well, it's a minor distraction, click update and it goes > away. > > If you go to the OUTPUT tab does it give you an error message? or does > it say "thing

[go-nuts] Re: Going places

2017-07-21 Thread Brian Ketelsen
Congrats - that's awesome - I beat you by a few years though :) On Friday, July 21, 2017 at 12:03:03 PM UTC-4, Michael Jones wrote: > > Maybe not news, and certainly not big news, but I just filed a patent that > uses Go source code to illustrate logical methods claimed in the invention. > So

[go-nuts] Re: How do you test a server?

2017-07-23 Thread Brian Wolter
As others have noted, you can use `net/http/httptest`. I'm not personally a huge fan of that package, though. As a result, I wrote an HTTP testing tool to run API tests against my servers. Of course, it can be used to test against any HTTP service, but it does happen to be written in Go. Test

[go-nuts] Re: go on Windows 10 from the bash shell (and the cmd shell)

2017-10-12 Thread Brian Ketelsen
WSL works perfectly well for Go development. It’s my primary dev environment Just treat it like Linux and you’ll be fine. -- 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

[go-nuts] Bug report github.com/golang/glog

2017-11-17 Thread Brian Kennedy
For the flag "log_backtrace_at" the flag expects "" for an empty value when calling Set(), but .String() will return ":0" when the value is empty. This results in a different "emtpy" value being generated by String() than is accepted by Set(). The following code will reproduce the issue. *Output

[go-nuts] static analysis tool for detecting unclosed io.Closer's

2017-12-15 Thread Brian Sorahan
I'm thinking something like what I described in the subject line could be useful. Does anyone know if there is one out there? I haven't been able to find one. Thank you! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this gr

[go-nuts] Re: static analysis tool for detecting unclosed io.Closer's

2017-12-28 Thread Brian Sorahan
That seems like a decent affirmation! Thanks. On Wednesday, December 20, 2017 at 9:42:55 AM UTC-6, Howard C. Shaw III wrote: > > In the absence of an affirmative, I'll just say that I did a search of my > own. > > This site: > https://github.com/mre/awesome-static-analysis > lists a bunch of st

Re: [go-nuts] Automated Gerrit reviews

2019-07-12 Thread Brian Hatfield
For Github, integration with the Checks API seems like the way you'd do it: https://developer.github.com/v3/checks/ On Fri, Jul 12, 2019 at 10:18 AM Ivan Borshukov wrote: > Thanks for sharing, it looks quite interesting. > > Do you think it would be possible (and easy) to extend the tool to supp

Re: [go-nuts] Need help to learn go lang

2019-07-19 Thread Brian Hatfield
Hi Veereshreddy! Welcome to Go! Here's a collection of links that I put together for some of my teammates who are new to Go: Basics / Introduction to Go GoByExample is a great resource if you've got experience with 2+ programming languages already. It quickly showcase

Re: [go-nuts] Need help to learn go lang

2019-07-19 Thread Brian Hatfield
Veeresh, Out of the links I provided, The Little Go Book is the closest to a "new programmer" book, but I don't think it really meets that need. Hopefully others on this list are aware of a good resource for "new to programming and want to try Go" and can link you to o

Re: [go-nuts] Need explaination for code

2019-07-26 Thread Brian Hatfield
}) [.etc] with an append call for each case you want to add. The example you provided just streamlines the whole process, and takes advantage of slice literals, anonymous struct definitions, and implicit struct literals within a slice definition. Hope that helps! Brian On Fri,

Re: [go-nuts] Code coverage for Automated api tests

2019-07-30 Thread Brian Hatfield
I'm not 100% sure what you're asking here - if you're asking "can Go parse Java and emit code coverage reports", the answer is of course that you'd have to develop that yourself. If you're asking "can Go emit code coverage reports for Go code LIKE what Java emits for Java code", have a look at: ht

Re: [go-nuts] Distributing task execution

2019-08-09 Thread Brian Hatfield
single task, but if you're already using it, that's how you might tackle it. There's lots of distributed task schedulers and platforms that could accomplish this goal, so I would start with the one that you're already using to scale your services on demand and determine if it has

Re: [go-nuts] Go gouroutines vs Rust threads

2019-11-13 Thread Brian Hatfield
Note: rust also recently landed async/await: https://blog.rust-lang.org/2019/11/07/Async-await-stable.html, though I have not looked into how it schedules the futures (ie, is it a one-cpu loop like swift or node, does it attempt to schedule futures in an M:N fashion like goroutines, etc). It's a re

[go-nuts] Should I return an error object, or a pointer to an error object?

2019-11-13 Thread Brian Candler
if I'm missing some other reason for using pointers in this context. Many thanks, Brian. -- 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+

Re: [go-nuts] Should I return an error object, or a pointer to an error object?

2019-11-13 Thread Brian Candler
n there are two ways it can be nil: a nil interface value, and a non-nil interface value containing a nil *T value. It was a big source of confusion to me initially :-) Still... if returning a pointer to an error is The Go Way, I guess I'll do that. It would be nice if the documentatio

Re: [go-nuts] Should I return an error object, or a pointer to an error object?

2019-11-13 Thread Brian Candler
Thanks. It's much clearer now. Cheers, Brian. -- 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.co

[go-nuts] Unable to lock versions when converting to go.mod

2019-11-27 Thread Brian Candler
ed to do to have "go build" use the dependencies listed in go.mod, rather than updating them? (I tried -mod=readonly, but then it just fails saying it needs to update them) Many thanks, Brian. -- You received this message because you are subscribed to the Google Groups "golan

[go-nuts] Re: Unable to lock versions when converting to go.mod

2019-11-27 Thread Brian Candler
I tried blowing away my entire ~/go tree to be sure. Starting from a fresh checkout (outside the ~/go tree), and a fresh checkout and go mod init ..., here's what the build does: $ go build ./... go: downloading github.com/go-kit/kit v0.5.1-0.20170917202734-0d313fb5fb3a *go: downloading github.

[go-nuts] Re: Unable to lock versions when converting to go.mod

2019-11-28 Thread Brian Candler
I got a private reply saying to try "go mod why -m github.com/prometheus/common" Starting with the original go.mod, I get different answers the first and second time I run it - by which time, go.mod contents have been updated. $ go mod why -m github.com/prometheus/common go: finding github.com/

[go-nuts] Re: Unable to lock versions when converting to go.mod

2019-11-28 Thread Brian Candler
I *think* I got to the bottom of this. It turns out the nrpe_exporter.go main module imports some non-vendored dependencies: - github.com/aperum/nrpe - github.com/prometheus/client_golang/prometheus - github.com/prometheus/client_golang/prometheus/promhttp - github.com/prometheus/co

Re: [go-nuts] Re: Unable to lock versions when converting to go.mod

2019-11-28 Thread Brian Candler
good going forward from this point. Thanks again, Brian. -- 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...@googl

Re: [go-nuts] fmt Package

2016-09-25 Thread Brian Hatfield
These weird function names have a long history . You might find the format specifiers to be a little weird, so take a look at the fmt package docs for some examples. If you check the Godoc for the specific functions, you'l

[go-nuts] fmt.Fscan without delimeter

2016-10-19 Thread Brian Picciano
integer. If there was a fmt.Scanf which simply had no delimiter, or where the delimiter was somehow set to io.EOF, I think that would work for what I'm doing. But I can't find anything like that. Does anyone know of anything that could help me do this? Or do I just have to implemen

Re: [go-nuts] fmt.Fscan without delimeter

2016-10-19 Thread Brian Picciano
wrote: > > On Wed, Oct 19, 2016, at 03:34 PM, Brian Picciano wrote: > > Hi there! My use-case involves reading all data off of an io.Reader and > scanning it into a receiver value provided by the user of my library. In > many ways the same thing as fmt.Fscan. The difference is t

Re: [go-nuts] fmt.Fscan without delimeter

2016-10-19 Thread Brian Picciano
t; unmarshalling. Document the expectations for the library user. :) > > //jb > > > ons 19 okt. 2016 kl 23:25 skrev Brian Picciano : > > Hi Ian! I don't think that would work, my data can be pretty much any > arbitrary data, including binary data. So I would need t

[go-nuts] time.Truncate output is _slightly_ different than expected

2016-11-11 Thread Brian Picciano
Here's a test case to show what I mean: func TestWat(t *T) { now := time.Now() trunc := rand.Int63n(int64(time.Second)) t.Logf("trunc: %v", trunc) t1 := now.Truncate(time.Duration(trunc)) t2 := time.Unix(0, trunc*(now.UnixNano()/trunc)) // this fails for some reason assert.Equal(t, t1, t2) } Fo

Re: [go-nuts] time.Truncate output is _slightly_ different than expected

2016-11-12 Thread Brian Picciano
e another, much earlier, reference > time. The remainder in that division will be different. > > //jb > > On 11 Nov 2016, at 15:53, Brian Picciano wrote: > > Here's a test case to show what I mean: > > func TestWat(t *T) { > now := time.Now() > trunc := rand

[go-nuts] Re: Deleting the /r/golang subreddit

2016-11-24 Thread Brian Ketelsen
Kill it. It's a wretched hive of scum and villainy.  The Go subreddit was the only thing similar to human and it is downright painful most of the time. On 11/24/2016 6:54:25 PM, Brad Fitzpatrick wrote: [+bketelson, dgryski] On Thu, Nov 24, 2016 at 3:53 PM, Brad Fitzpatrick mailto:bradf...@golan

[go-nuts] Re: Deleting the /r/golang subreddit

2016-11-24 Thread Brian Ketelsen
https://golangnews.com/ who runs this? On 11/24/2016 6:54:25 PM, Brad Fitzpatrick wrote: [+bketelson, dgryski] On Thu, Nov 24, 2016 at 3:53 PM, Brad Fitzpatrick mailto:bradf...@golang.org]> wrote: In light of the CEO of Reddit admitting to editing user comments (see dozen news stories today),

Re: [go-nuts] Re: Deleting the /r/golang subreddit

2016-11-24 Thread Brian Ketelsen
I'm happy to "donate" a subdomain of gopheracademy.com to the cause if existing sites aren't viable.  Especially with the end of year blog blitz coming, it's a very high traffic site. On 11/24/2016 8:04:20 PM, Pietro Gagliardi wrote: On Nov 24, 2016, at 7:42 PM, Bri

[go-nuts] December Blog Post Series

2016-12-01 Thread Brian Ketelsen
The December Blog Post series has begun.  We won't post daily links here, but you can catch them all at https://blog.gopheracademy.com The introductory post is here:   https://blog.gopheracademy.com/advent-2016/introduction/ Special thanks to Damian Gryski for coordinating and herding cats this

[go-nuts] http/2 client vs. GOAWAY

2017-01-11 Thread Brian Fallik
users of the Client to explicitly handle GOAWAY frames or not? If so this seems like a worthy addition to the package docs since it's not obvious that the client behavior can change based on the server support for http/2. Thanks, brian -- You received this message because you are subscr

Re: [go-nuts] Re: http/2 client vs. GOAWAY

2017-01-12 Thread Brian Fallik
hing strange, but I would open an issue > none the less. > > > > > On Wednesday, January 11, 2017 at 5:18:54 PM UTC-5, Brian Fallik wrote: >> >> Hello Gophers, >> >> I'm trying to understand some behavior of Go's http client in >> http2-mode.

[go-nuts] [ANN] JSON encoder w/ support for runtime conditional field exclusion

2017-02-08 Thread Brian Wolter
nt to certain roles, but include them when it's sent to others. Here's the repo, feedback is welcome: https://github.com/bww/go-json Brian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] Can the bit representation of a float64 silently change?

2017-04-10 Thread brian . brazil
entirely doing bit manipulation rather than floating point operations. As this is a mildly crazy idea, I've unfortunately not been able to find any documentation indicating one way or other. Thanks, Brian -- You received this message because you are subscribed to the Google Groups "

Re: [go-nuts] Can the bit representation of a float64 silently change?

2017-04-11 Thread Brian Brazil
o benchmark to make sure you are satisfied > about performance in your specific context. > At the level we care about it's all bit twiddling (e.g. XOR-based compression), so this shouldn't affect us. It'll all be benchmarked anyway. Yours, Brian > > On Mon, Apr 10, 2017

[go-nuts] Diversity Scholarship Applications Open / GopherCon 2017

2017-04-11 Thread Brian Ketelsen
the most diverse yet. Thank you, Brian Ketelsen & Erik St. Martin GopherCon team -- 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

[go-nuts] encoding/json: unexpected behaviour when unmarshalling into struct with interface{} field

2017-05-02 Thread Brian Stengaard
Hey Gophers, When unmarshalling JSON into a struct with a blank interface (interface{}) I get a surprising result: If I set the field to a pointer to a T value before unmarshalling, the data is filled out on the T value as expected. (See I2 in the playground example.) If I set the field to a

[go-nuts] Re: encoding/json: unexpected behaviour when unmarshalling into struct with interface{} field

2017-05-02 Thread Brian Stengaard
uct field addressable - then why not just update the underlying value? /Brian -- 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+unsubsc

[go-nuts] accidental 'testing' import

2017-05-10 Thread Brian Fallik
test flags. I'm wondering if the go tooling can/should do something to prevent or detect this? Can/should this be a `go vet` rule to detect main packages that end up importing 'testing'? Or would this make sense as an external tool, and does one already exist? Thanks! brian --

Re: [go-nuts] accidental 'testing' import

2017-05-10 Thread Brian Fallik
Hi, On Wed, May 10, 2017 at 11:10 AM, Jan Mercl <0xj...@gmail.com> wrote: > On Wed, May 10, 2017 at 5:01 PM Brian Fallik wrote: > >> Or would this make sense as >> an external tool, and does one already exist? > > Maybe grep of the output of 'go list' may

Re: [go-nuts] Why golang garbage-collector not implement Generational and Compact gc?

2017-05-16 Thread Brian Hatfield
This is a really great response. I appreciated the high-level overview in one place like this, and I feel like I learned something. Thanks for writing it up, Ian. On Tue, May 16, 2017 at 10:05 AM, Ian Lance Taylor wrote: > On Tue, May 16, 2017 at 2:01 AM, wrote: > > > > Generational and Compac

[go-nuts] Prometheus - NATS Exporter

2017-05-16 Thread Brian Flannery
For those interested, the NATS.io team have released a Prometheus exporter, you can find it here: https://github.com/nats-io/prometheus-nats-exporter Via the readme: *The Prometheus NATS Exporter consists of both a both a package and application that exports NATS server metrics to Prometheus

Re: [go-nuts] Multiple processes in parallel for cgo service

2019-12-06 Thread Brian Candler
Can you just run multiple instances of your program, each independently fetching messages from SQS? -- 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+u

[go-nuts] Re: [golang-dev] Go 1.13.5 and Go 1.12.14 are released

2019-12-09 Thread Brian Hatfield
Hi there, This appears to still not be available in Homebrew: https://github.com/Homebrew/homebrew-core/blob/master/Formula/go.rb Is there a plan for releasing 1.13.5 to Homebrew? Thanks! On Wed, Dec 4, 2019 at 9:01 PM Alexander Rakoczy wrote: > Hello gophers, > > We have just released Go ver

[go-nuts] Re: TLS Cipher suites TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8

2019-12-11 Thread Brian Candler
https://golang.org/pkg/crypto/tls/#pkg-constants -- 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. To view this discussion

[go-nuts] Re: TLS Cipher suites TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8

2019-12-16 Thread Brian Candler
There is always github.com/spacemonkeygo/openssl (even then, openssl deprecates non-recommended crypto, so you may need to build against an old version) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop rec

Re: [go-nuts] Simple worker pool in golnag

2019-12-28 Thread Brian Candler
On Friday, 27 December 2019 16:30:48 UTC, Bruno Albuquerque wrote: > > This might be useful too you, in any case: > > https://git.bug-br.org.br/bga/workerpool > > I think the point from Bryan Mills' video is, "worker pool" is something of an anti-pattern in go. goroutines are so cheap that you mi

Re: [go-nuts] Simple worker pool in golnag

2019-12-28 Thread Brian Candler
Certainly it's important to limit the concurrency, and in your case you need to process the larger tasks first. However, to me, the defining characteristic of a "worker pool" are: 1. workers are created before any tasks need to be done 2. the same worker handles multiple tasks sequentially 3. wor

Re: [go-nuts] Simple worker pool in golnag

2019-12-30 Thread Brian Candler
On Sunday, 29 December 2019 22:18:51 UTC, Robert Engels wrote: > > I agree. I meant that worker pools are especially useful when you can do > cpu affinity - doesn’t apply to Go. > > I think Go probably needs some idea of “capping” for cpu based workloads. > You can cap in the local N CPUs By d

[go-nuts] os.RemoveAll of directory that contains long paths hangs

2020-01-03 Thread Brian Samek
e, or if there is more information that would be useful to include in a bug report? Thanks, Brian -- 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-n

[go-nuts] Re: A question !

2020-01-05 Thread Brian Candler
Another advantage is that a single compiled binary is easy to deploy - without needing to set up a virtualenv, install dependent libraries, having to deal with different versions of python etc. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] Re: distributed runtime

2020-01-06 Thread Brian Candler
ls on that object are relayed back to the original host. Systems with immutable values / pass-by-value only (e.g. Erlang) avoid this issue, since it doesn't matter whether you have a reference to a copy or the the original. Regards, Brian. (*) or had: it's many years since I used

[go-nuts] Re: distributed runtime

2020-01-06 Thread Brian Candler
ls on that object are relayed back to the original host. Systems with immutable values / pass-by-value only (e.g. Erlang) avoid this issue, since it doesn't matter whether you have a reference to a copy or the the original. Regards, Brian. (*) or had: it's many years since I used

Re: [go-nuts] Panicking in public API ?

2020-01-07 Thread Brian Candler
On Tuesday, 7 January 2020 07:47:28 UTC, Axel Wagner wrote: > > Personally, I consider panics "run-time type-errors". That is, they > indicate a bug that couldn't be caught statically by the type-system - so > the program shouldn't have compiled in the first place and crashing it is > the right

[go-nuts] Re: Uncanny behaviour while syscalls

2020-01-19 Thread Brian Candler
As a first step, try printing out the error returned by syscall.Chroot() -- 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.

[go-nuts] Re: Information hiding within a package

2020-01-21 Thread Brian Candler
On Tuesday, 21 January 2020 11:04:28 UTC, Orson Cart wrote: > > I guess I'm looking for something like opaque pointers which were employed > to good effect in C to hide implementation details from 'peer' source > files: https://en.wikipedia.org/wiki/Opaque_pointer#C > > You can hide implementatio

[go-nuts] Re: script with go routine is fastest the second time

2020-01-21 Thread Brian Candler
Could it be that the files from disk are "hot" in cache on the second run? Try emptying the cache before the second run. Linux: sync; echo 3 > /proc/sys/vm/drop_caches -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this gr

[go-nuts] Re: Can individual struct attributes be garbage collected?

2020-01-23 Thread Brian Candler
As long as t is alive, it keeps everything that it references alive. If you want the slice referenced by t.unused to be garbage-collected, then set t.unused = nil. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group a

[go-nuts] Re: Experience report on a large Python-to-Go translation

2020-01-25 Thread Brian Candler
Very insightful. I am relatively new to go, but I would like to make a few observations. 1. When the issue of keyword arguments has come up before, usually someone suggests passing a struct as the function argument. Did you try this? It might be worth mentioning in your analysis, if only to g

Re: [go-nuts] [Proposal] Change how gofmt formats struct fields

2020-01-31 Thread Brian Candler
I use "diff -ubB foo bar" to compare files where I don't care about whitespace differences (-b within line, -B for blank lines). I believe "git diff" supports -b too. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this grou

[go-nuts] Re: Experience report on a large Python-to-Go translation

2020-02-02 Thread Brian Candler
On Saturday, 25 January 2020 22:16:26 UTC, Eric Raymond wrote: > > > And that's the insight that led be to the extension I proposed. I asked > myself what the most natural way to pass out a soft close might be. > > Suppose we continue with the idea of an iterator being a goroutine which stuffs

[go-nuts] Re: Anomaly in RunCommand and the exit status of the child process

2020-02-03 Thread Brian Candler
I just tried this on CentOS 7.4: # *script -e -q -c "date; exit 1"; echo $?* Mon 3 Feb 19:21:17 GMT 2020 1 # *script -e -q -c "date; exit 1" https://groups.google.com/d/msgid/golang-nuts/3fea01f3-115a-4523-af6b-544bdab810f1%40googlegroups.com.

Re: [go-nuts] Question about 'import' statement

2020-02-03 Thread Brian Candler
Also, I believe "go fmt" sorts the imports. -- 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. To view this discussion on t

[go-nuts] Re: Experience report on a large Python-to-Go translation

2020-02-04 Thread Brian Candler
On Monday, 3 February 2020 23:10:01 UTC, Jon Conradt wrote: > > While names arguments like foo(x= 1.0, y = 23) may look like syntactic > sugar, I think you are right that they improve readability, especially of > long argument lists. The counter argument I suppose if that you could pass > struct

[go-nuts] Re: Error checking in Go: The `try` keyword

2020-02-08 Thread Brian Candler
On Saturday, 8 February 2020 07:02:34 UTC, addi t0t08 wrote: > > I think the keyword we are looking for is `pass`. Similarly, `pass` only > needs to return if err != nil. > > func writeSomething() error { >f, err := os.Open("file.dat") >pass err >defer f.Close() > >f.WriteString(".

[go-nuts] Re: Error checking in Go: The `try` keyword

2020-02-08 Thread Brian Candler
On Saturday, 8 February 2020 10:33:03 UTC, addi t0t08 wrote: > > No, 'pass' accepts an error type. in this case Foo function must return an > error type otherwise that would be a compile error. > > Ah I see: you are relying on the behaviour of errors.Wrap(nil, "dontcare"), which is valid and retu

[go-nuts] Re: Error checking in Go: The `try` keyword

2020-02-08 Thread Brian Candler
On Saturday, 8 February 2020 18:38:19 UTC, addi t0t08 wrote: > > > Also, without any additional changes to the language. Go already allows > separating statements with semicolons, so it would be even possible to do > the following. > > > > f, err := os.Open(file1) ; pass err > defer f.Close() > >

Re: [go-nuts] Why Discord is switching from Go to Rust

2020-02-10 Thread Brian Candler
On Monday, 10 February 2020 10:09:47 UTC, Kevin Chadwick wrote: > > p.s. Does anyone know how well Rust reads as this is highly important to > me? > I have read Rust described as being in the spirit of "pragmatic Haskell". https://jmmv.dev/2018/07/rust-vs-go.html https://jmmv.dev/series.html#Ru

[go-nuts] Re: arm64 builder on raspberry pi 3B/3B+

2020-02-12 Thread Brian Candler
Interesting to know. When you say "an arm64 builder", I presume you already know that go can cross-compile any architecture on any machine (using GOOS/GOARCH). For testing, di

Re: [go-nuts] Go without garbage collector

2020-02-12 Thread Brian Candler
On Wednesday, 12 February 2020 05:00:41 UTC, robert engels wrote: > > I found a more recent academic paper that proves my conclusions: > > > https://www.researchgate.net/publication/326369017_From_Manual_Memory_Management_to_Garbage_Collection > > It's a student paper. The bit that caught my eye

Re: [go-nuts] Go without garbage collector

2020-02-12 Thread Brian Candler
On Tuesday, 11 February 2020 23:55:48 UTC, deat...@gmail.com wrote: > > What about #vlang ? https://vlang.io/ > > https://vlang.io/docs#memory "(Work in progress) There's no garbage collection or reference counting. V cleans everything up during compilation. If your V program compiles, it's guar

Re: [go-nuts] Go without garbage collector

2020-02-13 Thread Brian Candler
On Wednesday, 12 February 2020 22:57:04 UTC, robert engels wrote: > > (Or even Go's GC performance progression - but as I mentioned, in this > particular test the lack of a generational collector is holding it back). > > This is discussed in great detail here: https://blog.golang.org/ismmkeynote

Re: [go-nuts] Question about the zero-value design: Why pointers zero value is not the zero value of what they points to?

2020-02-14 Thread Brian Candler
In addition, consider: how would you implement the zero default when the type is self-referential? For example: type Treenode struct { left *Treenode right *Treenode } var Tree1, Tree2 *Treenode Also consider deeply nested types which include pointers to structs which contain pointers etc

[go-nuts] Re: Proposal: Error handling with else catch (else keyword)

2020-02-16 Thread Brian Candler
Code like this: f, err := os.Open("filename.ext") if err != nil{ log.Fatal(err) } would become: f := os.Open("filename.ext") else err != nil { log.Fatal(err) } The `err` variable in the example above is automatically initialized to the last return value of the function call `os.Open`.

[go-nuts] Re: Proposal: Error handling with else catch (else keyword)

2020-02-16 Thread Brian Candler
One other thing: unless you change the entire syntax of the go language, your proposed "else" modifier needs to go on the same line as the statement it relates to. For the reason see: https://golang.org/doc/faq#semicolons -- You received this message because you are subscribed to the Google Gr

Re: [go-nuts] Question about the zero-value design: Why pointers zero value is not the zero value of what they points to?

2020-02-17 Thread Brian Candler
A "usable" nil map, i.e. being able to insert into it straight away, I sympathise with. Remember though that you can't append "in place" to a nil slice: it returns a new slice object. https://play.golang.org/p/dL-r74C5m_w I presume you don't want to write the same for maps as you do for slices

Re: [go-nuts] Question about the zero-value design: Why pointers zero value is not the zero value of what they points to?

2020-02-17 Thread Brian Candler
That's a very good point: * A map can contain any type of value * map[value_not_present] is defined to return the zero value * If the map contains other maps: (a) you don't want a new map to spring into life every time you access a non-existent key - especially not a floating map which isn't stor

[go-nuts] Re: exec.Command() always returns error status of 1 when it was executed successfully

2020-02-18 Thread Brian Candler
On Tuesday, 18 February 2020 01:40:32 UTC, Dean Schulze wrote: > > I expected it to return 0 when executing successfully. What am I missing? > Given your pipeline: lspci | grep -i vga | grep -i nvidia the exit status returned is the exit status of the last command (grep -i nvidia). Then if yo

[go-nuts] Re: stringer command and generated String() function

2020-02-18 Thread Brian Candler
Could you provide a link to where you found this code? I imagine it was done that way just for demonstrating some features of go, such as slicing and array lookups. A simpler and faster way again would be to use a map. https://play.golang.org/p/ntjhesMsSA9 -- You received this message because

[go-nuts] Re: stringer command and generated String() function

2020-02-18 Thread Brian Candler
Or, indeed, an array of strings. https://play.golang.org/p/3Eg9va4Krqo -- 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. T

Re: [go-nuts] Re: stringer command and generated String() function

2020-02-18 Thread Brian Candler
On Tuesday, 18 February 2020 09:04:49 UTC, Jan Mercl wrote: > > > A simpler and faster way again would be to use a map. > > https://play.golang.org/p/ntjhesMsSA9 > > I don't see how could be map lookup possibly faster than slice > indexing. Have you some measurements to share? > > No, I didn't

Re: [go-nuts] Question about the zero-value design: Why pointers zero value is not the zero value of what they points to?

2020-02-19 Thread Brian Candler
On Wednesday, 19 February 2020 10:59:33 UTC, klos...@gmail.com wrote: > > I see in a programming language as my most important tool. I use it every > single day to make a living. It is because of that importance that I want > me (and my team) to be as efficient as possible when working with it, s

Re: [go-nuts] Question about the zero-value design: Why pointers zero value is not the zero value of what they points to?

2020-02-19 Thread Brian Candler
I just don't like the implication that these things *haven't* been thought about, because nobody could be bothered to polish the "rough edges". -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving ema

[go-nuts] Re: array json streaming inside json object

2020-02-20 Thread Brian Candler
There is even a "standard" for this: http://jsonlines.org/ -- 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. To view this

[go-nuts] Re: [Proposal] Change how gofmt formats struct fields

2020-02-21 Thread Brian Candler
On Tuesday, 18 February 2020 18:16:57 UTC, Manlio Perillo wrote: > > Here is an example of a diff with a lot of noise, where the actual change > is very hard to see: > https://gist.github.com/perillo/c5b3bdff9e8db9c89f316670d129c0dd > > Note that using `git diff -w` is not a solution, since it can

Re: [go-nuts] Preserving extra properties using JSON unmarshal / marshal?

2020-02-22 Thread Brian Candler
Looks like your thoughts are the right ones: https://stackoverflow.com/questions/33436730/unmarshal-json-with-some-known-and-some-unknown-field-names -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receivin

Re: [go-nuts] Bound checks elimination hint.

2020-02-22 Thread Brian Candler
On Saturday, 22 February 2020 11:54:43 UTC, Nigel Tao wrote: > > > If the step (e.g. 3) does not divide the length evenly, then e.g. "i > += 3" can overflow such that i becomes negative, even though the > "len(a)" in the "i < len(a)" condition is a legitimate array or slice > length: a non-negat

Re: [go-nuts] Understind how to apply timeout using gouritine

2020-02-26 Thread Brian Candler
> > My previous questions were: How can I cancel execution of goToSleep() > function? How can I break it? > > Maybe you want something like this? https://play.golang.org/p/2dKbVMxBjaJ context is the standard way to be able to cancel one or more of goroutines,

Re: [go-nuts] Understind how to apply timeout using gouritine

2020-02-26 Thread Brian Candler
Perhaps slightly clearer: https://play.golang.org/p/DDZxqaEFi-T -- 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. To vie

Re: [go-nuts] Understind how to apply timeout using gouritine

2020-02-27 Thread Brian Candler
The magic behind contexts is that they use a channel but without sending any data over it. Instead, *closing* the channel is a signal to terminate. This allows you to have multiple goroutines listening on the channel, and they will *all* receive the termination signal, as a broadcast. (It wou

Re: [go-nuts] How to handle EINTR from syscall.Dup2

2020-02-29 Thread Brian Candler
Just to ask the an obvious question: is dup2() idempotent or not? > > -- 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. T

  1   2   3   4   5   6   7   8   9   >