[go-nuts] mmapping over Go heap

2024-01-10 Thread Nick Zavaritsky
Hi, Packages offering memory mapped files in golang follow one of the two possible routes: 1) memory is accessed via io.Reader (e.g. golang.org/x/exp/mmap); 2) mapped memory is directly exposed as []byte; accessing it after munmap leads to SIGSEGV or worse (e.g. github.com/edsrzf/mmap-go).

[go-nuts] Re: Using underscore in return statements - a small convenience idea

2023-08-23 Thread Nick Craig-Wood
Ah ha! I thought there would be a related issue I couldn't find :-) `zero` would remove most of the pain though IMHO `_` looks neater in the return statements! Thanks for the pointer Brian. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] Using underscore in return statements - a small convenience idea

2023-08-23 Thread Nick Craig-Wood
// Sometimes you end up typing this having to return // a value you made up but don't care about. func f1() (int, error) { return -1, errors.New("something went wrong") } // Or maybe like this with named return values. func f2() (a int, err error) { return a, errors.New("something went wrong") }

Re: [go-nuts] Re: Making temporary changes to 3rd party modules without breaking go install

2023-02-27 Thread Nick Craig-Wood
This is super annoying - you'll see me in the bug report you linked! The way to work around it is to fork the upstream repo into your own repository, apply the one line patch there, then change all the package lines and go.mod to point to your new repo. After you've done all that then in the

Re: [go-nuts] Pass SQL null values to Parquet

2023-01-22 Thread Nick White
is the easiest way to pass to parquet, I don't know, but I'd imagine it shouldn't be too bad. Nick -- 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

Re: [go-nuts] What's go's convention for specifying the equivolent of configure --prefix?

2022-12-03 Thread Nick White
On Thu, Dec 01, 2022 at 08:42:46PM -0800, hey...@gmail.com wrote: > Using a Makefile makes sense. > > And thanks for bringing embed to my attention. I never knew it exists. Sounds > like it can solve my problem. Yeah, embed is brilliant, I'm glad it can help you. One thing I forgot to mention

Re: [go-nuts] What's go's convention for specifying the equivolent of configure --prefix?

2022-12-01 Thread Nick
On Thu, Dec 01, 2022 at 06:21:37PM +0800, Glen Huang wrote: > Const is the ideal choice, but how do users of my program specify the path > when > they compile it? I don't think this is something for which there is a "canonical Go way", so I'd say something like a tiny makefile that sets the path

Re: [go-nuts] Golang JPEG2000 implementation / Gauging community interest in supporting it?

2021-11-05 Thread Nick
nd testing, though, that much I can happily offer :) Nick -- 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

Re: [go-nuts] Re: Map to struct and vice versa

2021-05-18 Thread Nick Keets
Thanks everyone for your responses. structs is interesting, but archived, pre modules even. Using reflect directly also doesn't seem that bad and I do want error handling, so it looks like nothing beats JSON in terms of UI. On Mon, May 17, 2021 at 6:22 PM Howard C. Shaw III wrote: > The

[go-nuts] Map to struct and vice versa

2021-05-17 Thread Nick Keets
Is there an easy way to go from a map to a struct and vice versa? e.g. going from: m := map[string]interface{}{"a": "x", "b": 5} to an instance of: type T struct { A string B int } I can do this going through JSON (marshal the map, unmarshal into struct), but is there a more

Re: [go-nuts] SignatureDoesNotMatch error when S3 object name contains “=”

2021-04-16 Thread Nick White
hat gets sent with the new code - maybe the '=' was escaped in some manner. Nick -- 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

Re: [go-nuts] Modules... why it has to be so painfull?

2021-04-08 Thread Nick Keets
On Thu, Apr 8, 2021 at 2:08 PM 'Carla Pfaff' via golang-nuts < golang-nuts@googlegroups.com> wrote: > On Thursday, 8 April 2021 at 12:48:28 UTC+2 nick@gmail.com wrote: > >> But what if you don't even have a domain for your source code? Sure you >> can use a fake

Re: [go-nuts] Modules... why it has to be so painfull?

2021-04-08 Thread Nick Keets
d then use replace, and then remember to not commit the replace because someone else may have the code in a different location, etc etc. Imagine if it was the other way around: my_source_location/ ProjectA/ go.mod module ProjectA replace /home/nick/src/ProjectA => mydom

Re: [go-nuts] still struggling to understand modules

2021-02-23 Thread Nick Keets
Hello rob, here's what I do. For every dir in ~/go/src run go mod init with the dir name. e.g.: cd ~/go/src/foo go mod init foo cd ~/go/src/bar go mod init bar ... If package foo depends on libfoo (also in ~/go/src) you can add a replace line in foo's go.mod e.g. echo "replace libfoo =>

Re: [go-nuts] Announcing godocs.io, a maintained fork of godoc.org

2021-01-21 Thread Nick
Hi Drew, Quoth Drew DeVault: > With the help of some volunteers, we have already made modest, > conservative improvements to godoc.org. Some features have been > updated to work with JavaScript disabled, dead links and obsolete tools > have been pruned, and our fork should be easier to use on

Re: [go-nuts] [ANN] CGo-free sqlite database/sql driver 1.4.0 for linux/amd64 released

2020-08-27 Thread Nick
t's just translated-from-C? What happens if one (erroneously) tries to build a project that uses this library, using a non-supported architecture? Will go complain? Thanks, anyway, looks very cool, I look forward to learning more! Nick -- You received this message because you are subscribed to t

Re: [go-nuts] compress/flate

2020-07-20 Thread Nick Keets
Updating those 2 lines would be the least of our problems if this value ever changes. On Fri, Jul 17, 2020 at 12:33 PM Jan Mercl <0xj...@gmail.com> wrote: > On Fri, Jul 17, 2020 at 11:23 AM Heisenberg wrote: > > > > Constant definition in token.go: > > > > literalType = 0 << 30 > > > > The only

[go-nuts] Re: Considering dropping GO386=387

2020-07-15 Thread Nick Craig-Wood
I make a GO386=387 build for rclone, eg https://github.com/rclone/rclone/issues/437 People love running rclone on ancient computers to rescue data off them I guess. This would affect a very small percentage of users and there are always older versions of rclone they can use so I'm not too

[go-nuts] Generics and parentheses

2020-07-15 Thread Nick Craig-Wood
In my mind the use of [ ] clashes horribly with the array declaration syntax. When I see [int] in particular my brain says, ah array declaration of size int, what, no wait... This makes [identifier] mean two different things depending on whether indentifier is a const integer or whether

Re: [go-nuts] Image Resize and Crop

2020-05-11 Thread Nick
Quoth Vivi: > How do you advice to resize and crop JPEG and PNG or probably WebP images > without rely on 3rd parties dependencies? > > It was hard to find a good snippet or could be useful to have basic API > function in Go standard library since it's a common feature. I'd encourage you to

Re: [go-nuts] modules and indirect

2020-04-14 Thread Nick
Quoth Jérôme LAFORGE: > I am surprised that go mod tidy doesn't remove all unnecessary > dependencies from the go.mod. > > It raises some questions: > - Is it unsafe to do this kind of process to ensure that all unnecessary > dependencies are removed? > - Why go mod tidy doesn't remove them? > -

Re: [go-nuts] Re: Where is the version number for a golang module declared?

2020-03-12 Thread Nick
the go.mod file perfectly good replacements for these use cases? I get the feeling I'm missing something... I agree that anything that penalises people for not using Google services is problematic, but I don't see how that's happening here. Nick -- You received this message because you are s

Re: [go-nuts] godoc-static - Generate static documentation for your packages

2020-02-10 Thread Nick
would be more liable to break with future versions of godoc which change the output. Anyway, good job, I may use it myself soon, and will let you know how I get on. Nick -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

Re: [go-nuts] Go 2 generics counterproposal: giving up restricting types

2019-05-31 Thread Nick Keets
On Thu, May 30, 2019 at 9:26 PM Ian Lance Taylor wrote: > One of my guidelines for an acceptable generics proposal is that > people can write Min and Max. Your proposal admits that it doesn't > permit that. I think that is a problem. I'm fine with the general > idea of "do 80% of the job" but

Re: [go-nuts] [ANN] Fyne reaches 1.0

2019-03-20 Thread Nick
for each platform? I'm sure you have good reasons for doing it the way you are, I'm just keen to learn! Congratulations to all involved once again, and I look forward to using Fyne soon :) Nick -- You received this message because you are subscribed to the Google Groups "gola

Re: [go-nuts] I have an issue in go after make

2019-03-08 Thread Nick
basics, sudo, permissions, stuff like that. Plenty to learn, all useful stuff :) Also, you replied just to me, I'm cc-ing the list again, so the answers are in the list archive in case it helps others. Nick Quoth Nada Saif: > Thank you, now I could build a hello world go program successfully.

Re: [go-nuts] I have an issue in go after make

2019-03-08 Thread Nick
-rf /home/nada/.cache/go-build Then you should be able to build your project with a simple: $ go build No sudo needed. Hope this gets you on your way :) Nick -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this gr

[go-nuts] Best practices for using methods on types to write SQL

2018-12-20 Thread Nick
to do this cleanly and reusably would be very welcome indeed - as I say, I'm new enough to Go that maybe I'm still thinking about this all wrong! Thanks in advance, Nick -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubs

[go-nuts] Re: [ANN] pygor: yet another Python to Go regurgitator

2018-10-20 Thread Nick Craig-Wood
Very interesting :-) It looks like a useful tool for producing a first rough cut of a python program. -- Nick On 20/10/18 05:16, Raffaele Sena wrote: Inspired by ESR pytogo (and tired of writing python code), I went the complete opposite way and came up with pygor: https://github.com/raff

Re: [go-nuts] Correct way to bump a Go library to v2

2018-04-13 Thread Nick Snyder
> If you wanna support go both for v1 and v2 using current import path then > you've no choice - you have to keep both version in master. Yeah, this seems to be the case. There is an option to use gopkg.in to get alternate import path for v1. > This way users of go+v1 will have to rewrite

[go-nuts] Correct way to bump a Go library to v2

2018-04-12 Thread Nick Snyder
I am about to bump a Go library to v2. Here are some objectives that I have: 1. New import path for v2 2. Want it to work with go and vgo. 3. Prefer to avoid keeping v1 code around in master branch. (1) and (2) are actually pretty easy. I just put the code in a new v2 dir at the root of my

Re: [go-nuts] CGO & Plugins

2017-06-03 Thread Nick Groenen
earlier this year. The "caveats" section has some remarks and references you might find interesting in this context. You can find it at https://nick.groenen.me/posts/2017/01/09/plugins-in-go-18/ -- Nick Groenen https://nick.groenen.me/ -- You received this message because you are

RE: [go-nuts] Problem compiling from source

2017-05-14 Thread Nick Treleaven
Thanks for the suggestion but I'm afraid it didn't work. Any other ideas? Nicholas Treleaven -Original Message- From: Ian Lance Taylor [mailto:i...@golang.org] Sent: 14 May 2017 14:06 To: Nick Treleaven Cc: golang-nuts Subject: Re: [go-nuts] Problem compiling from source On Sun, May

Re: [go-nuts] How can I implement a TCP server using a model which similar to epoll (or kqueue, IOCP) rather than just using goroutine for each client?

2017-03-06 Thread Nick Rio
tight loop, but if you know a point where may > clients idle it may be worth it. > > //jb > > > On 6 Mar 2017, at 09:26, Nick Rio <nick...@gmail.com > > wrote: > > > > The application is working right now. Current work for me is to found a > way to red

Re: [go-nuts] Re: How can I implement a TCP server using a model which similar to epoll (or kqueue, IOCP) rather than just using goroutine for each client?

2017-03-06 Thread Nick Rio
6, 2017 at 6:58:50 PM UTC+8, John Souvestre wrote: > > Ni Nick. > > > > Is 1GB too much? What is your target for number of connections and max > memory size? > > > > You are using about 100KB per connection? Is there any way to reduce > this?

Re: [go-nuts] Re: How can I implement a TCP server using a model which similar to epoll (or kqueue, IOCP) rather than just using goroutine for each client?

2017-03-06 Thread Nick Rio
Hi Konstantin, Thank you for the hit. I'll look into it. On Monday, March 6, 2017 at 5:25:47 PM UTC+8, Konstantin Khomoutov wrote: > > On Mon, 6 Mar 2017 12:01:43 +0300 > Konstantin Khomoutov wrote: > > > > The application is working right now. Current work for

Re: [go-nuts] Re: How can I implement a TCP server using a model which similar to epoll (or kqueue, IOCP) rather than just using goroutine for each client?

2017-03-06 Thread Nick Rio
*From:* golan...@googlegroups.com [mailto: > golan...@googlegroups.com ] *On Behalf Of *Nick Rio > *Sent:* 2017 March 05, Sun 23:28 > *To:* golang-nuts > *Subject:* [go-nuts] Re: How can I implement a TCP server using a model > which similar to epoll (or kqueue, IOCP) rather than just using gorout

[go-nuts] Re: How can I implement a TCP server using a model which similar to epoll (or kqueue, IOCP) rather than just using goroutine for each client?

2017-03-05 Thread Nick Rio
Thank you for reply. No guys, it's me using too many memories, not Goroutine. However, I believe if I can make those code in epoll-style, I can then build a task queue to handle those connections one by one in a queue when they back to active. For example, start one *accepter* goroutine + few

[go-nuts] Re: net/http best way to get request/response header size

2016-12-13 Thread Nick V
For what it's worth, MaxHeaderSize only works for POST/PUT requests. On Tuesday, December 13, 2016 at 11:19:06 AM UTC-8, Tamás Gulácsi wrote: > > 2016. december 13., kedd 14:57:47 UTC+1 időpontban kaitoY Kors a > következőt írta: >> >> Hello, >> >> In the current implementation of net/http and

Re: [go-nuts] Thinking OO virtual function in Go

2016-11-24 Thread Nick Patavalis
On Thu, Nov 24, 2016 at 10:00 AM, Haddock wrote: > > This is merely resorting to a shared function. This does not really > cover overwriting in the OO sense. The article I mentioned shows how > to do this: > http://objectscape.blogspot.de/2013/09/inner-pattern-to-mimic-method.html

Re: [go-nuts] Re: Thinking OO virtual function in Go

2016-11-24 Thread Nick Patavalis
Hi, On Thu, Nov 24, 2016 at 9:33 AM, Haddock wrote: > > Here is another blog that shows a way how to do this: > http://objectscape.blogspot.de/2013/09/inner-pattern-to-mimic-method.html > Clever! I would like, though, to underscore the conclusion reached by the original post

Re: [go-nuts] Thinking OO virtual function in Go

2016-11-23 Thread Nick Patavalis
​ As I said ​ ​ before, Go's flavor of OO is different from that of other languages. Don't try to map concepts one-to-one, or you will end up with very contrived solutions. Always look at the big picture (why am I doing this?) and don't get side-tracked by synthetic examples. Most important is

Re: [go-nuts] Thinking OO virtual function in Go

2016-11-23 Thread Nick Patavalis
On Wednesday, November 23, 2016 at 5:17:11 PM UTC+2, Tong Sun wrote: > > Can you make it work on play.golang.org, from this code > https://play.golang.org/p/QjCtD9rGpa, according to your plan? > For this specific example, something like this: https://play.golang.org/p/FsorWRaLKk /npat --

Re: [go-nuts] Thinking OO virtual function in Go

2016-11-23 Thread Nick Patavalis
l there? > > On Wed, Nov 23, 2016 at 4:05 AM, Nick Patavalis <nick.patava...@gmail.com> > wrote: > >> Hi, >> >> In your *second* example, making Output() a method of Animal will work, >> since it uses only the members (fields) of Animal, and not the field

Re: [go-nuts] Thinking OO virtual function in Go

2016-11-23 Thread Nick Patavalis
. /npat On Wednesday, November 23, 2016 at 6:08:00 AM UTC+2, Tong Sun wrote: > > No Nick, making Output() a member method won't work. > See my OP and Jesse's answer. I.e., I have to change it from a member > function to a pure function. > > On Tue, Nov 22, 2016 at 6:25 PM, Nick

[go-nuts] implement 'error operator' in go similar to rust?

2016-11-16 Thread Nick Evgeniev
hi, I've just read about 'error operator - ?' introduced in rust https://www.infoq.com/news/2016/11/rust-113-released and ... do you think we could see something like this in go as well? It could eliminate lot's of 'idiomatic if spaghetti' in go programs... hopefully it's less complex than

[go-nuts] Re: Version Control entire GOPATH

2016-11-13 Thread Nick Stogner
which accomplish this: https://github.com/nstogner/gomono. After installing them in the client repo, the gophers should be able to proceed along without worrying about how they use go-get... Let me know what you think. On Saturday, November 12, 2016 at 12:00:08 PM UTC-5, Nick Stogner wrote

[go-nuts] Version Control entire GOPATH

2016-11-12 Thread Nick Stogner
I would like to version control my entire GOPATH to store all of my go code in a monolithic repository. (see http://danluu.com/monorepo/ or https://blog.gopheracademy.com/advent-2015/go-in-a-monorepo/) The problem that I run into: how to manage dependencies with "go get" ?.. I would like to

Re: [go-nuts] What are the consequences of go install -ldflags "-s"

2016-11-04 Thread Nick Craig-Wood
On 04/11/16 14:55, Ian Lance Taylor wrote: > On Fri, Nov 4, 2016 at 7:39 AM, Nick Craig-Wood <n...@craig-wood.com> wrote: >> I know I can build go binaries passing the `-s` flag to the linker to >> strip them and make them smaller. In my tests (with rclone) it makes it

Re: [go-nuts] Re: Stopping a server

2016-10-28 Thread Nick Patavalis
On Oct 28, 2016 14:48, "Peter Mogensen" wrote: > > So ... bottom line ... defining Server objects as one-shot/single-use allows you to define the Kill()/Shutdown() semantics to simply exhaust that single-use. (an being idempotent) ... making it irrelevant whether the server has

Re: [go-nuts] Re: Stopping a server

2016-10-28 Thread Nick Patavalis
On Oct 28, 2016 14:32, "roger peppe" wrote: > > Yes, that's right. The main difference from a context is that a context provides > no way to know when things shut down. This, I think, is by design - things > like ErrGroup provide that functionality when needed. Yes, exactly.

Re: [go-nuts] Re: Stopping a server

2016-10-28 Thread Nick Patavalis
On Fri, Oct 28, 2016 at 8:15 AM, Peter Mogensen wrote: > > The point being that it's up to the user of the interface how to specific > Server implementation should work. > Yes, of course, but an interface with just two methods (Serve / Stop) is not enough to provide race-free

Re: [go-nuts] Re: Stopping a server

2016-10-27 Thread Nick Patavalis
Hi, On Thu, Oct 27, 2016 at 9:34 PM, Peter Mogensen wrote: > > Technically that depends on the Server implementation. > But in the provided http.Server extension, the answer is "nothing": > > func (srv *Server) Shutdown() { > srv.runlock.Lock() > defer

[go-nuts] Re: Stopping a server

2016-10-27 Thread Nick Patavalis
On Thursday, October 27, 2016 at 6:35:40 PM UTC+3, Peter Mogensen wrote: > > It's a valid question whether Context is the concept to use for starting > and stopping server instances. ... I'm not fully convinced. It seems to > me it's more meaningfull for more transient things like Requests. On

[go-nuts] Stopping a server

2016-10-27 Thread Nick Patavalis
Hi, I'm writing a package that allows the user to create and start server instances. A server instance is created like this: srv := pkg.NewServer( ... params ... ) and started like this: err := srv.Start() Start does not normally return (unless an unrecoverable error occurs). The user

Re: [go-nuts] Re: do i need to wait all child routine exit

2016-10-25 Thread Nick Patavalis
On Tuesday, October 25, 2016 at 5:17:10 PM UTC+3, Axel Wagner wrote: > > I suggest using errgroup > (and/or context.Context in > general) instead of rolling your own cancellation and timeout logic. It >

[go-nuts] Append consecutive slices, same underlying array

2016-10-20 Thread Nick Patavalis
Hi, It seems that the built-in append does not check for a situation like the following, and needlessly copies data, when it could avoid it. func appendBytes(a, b []byte) []byte { if len(b) == 0 { return a } // Shouldn't append() check for

Re: [go-nuts] Architect a daemon program

2016-10-12 Thread Nick Craig-Wood
named as`myprog`) to fork into the background > (if possible) with the "start" command-line option. You could try this https://github.com/sevlyar/go-daemon This implements the daemonization by re-running the executable with an environment variable. -- Nick Craig-Wood <n...@crai

Re: [go-nuts] Slow compile times

2016-10-04 Thread Nick Craig-Wood
> go install github.com/coreos/pkg/capnslog > > > But this does not help me here. Has anybody an idea to fix this 'issue'? try `go test -i` to install the dependencies for the test. -- Nick Craig-Wood <n...@craig-wood.com> -- http://www.craig-wood.com/nick -- You received t

[go-nuts] json inline

2016-09-27 Thread Nick Leli
After inspecting some Kubernetes code , I see the json `inline` used throughout to create persistent structs. This topic appears to be a proposal

Re: [go-nuts] file or folder encryption tool

2016-09-19 Thread Nick Craig-Wood
ithub.com/ncw/rclone for code. What you would do is configure a crypt remote using a directory on your disk. You can then rclone copy /path/to/unencryptedfiles remote: It perhaps isn't exactly the workflow you want but it is written in Go! It uses the go port of secret box for encrypting stuff.

[go-nuts] Copying http.DefaultTransport

2016-09-14 Thread Nick Craig-Wood
://play.golang.org/p/l2mkCTZSzL Is there a better way? Should making an http.Transport with the default settings in be something the standard library should support? Maybe a NewDefaultTransport() function? -- Nick Craig-Wood <n...@craig-wood.com> -- http://www.craig-wood.com/nick -- You re

Re: [go-nuts] Speeding up Go Report Card

2016-09-05 Thread Nick Craig-Wood
-linux So I'd check to see if you are running out of threads, or memory because of lots of threads. > The server we run this on is a Digital Ocean droplet with 1 GB of RAM > (would upgrading it help?) > > We normally only see issues on repositories with a very large number of > files

Re: [go-nuts] Re: Go is for everyone

2016-07-20 Thread Nick Sarbicki
to learn more about how languages work and get closer to the hardware. As an aside: for those discussing the ability to teach a topic using your students level of understanding instead of your own more specialised perspective. The term for this is decentering. - Nick. On Wed, 20 Jul 2016, 12:07

[go-nuts] is there any plan to reduce native call overhead in go?

2016-07-14 Thread Nick Evgeniev
Hi, Is there any plan to reduce (remove) significant overhead for native calls in GO? With recent advances in minimizing gc pauses go becomes more attractive for low latency things... but hundreds nanoseconds overhead imposed on every C call makes it pointless :( -- You received this

Re: [go-nuts] Handling dynamic and unknown number of wait groups?

2016-06-30 Thread Nick Craig-Wood
o actually do this well > in Go. > > Cheers, > > Inspectre > > -- > 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

Re: [go-nuts] How to be safe in Go?

2016-06-24 Thread Nick Pavlica
--- go run --chk_concurrent mylib.go Notice: "net/http" calls concurrent operations on the Handle function. ------