[go-nuts] Re: command to pre-compile vendor libs

2024-04-30 Thread Anthony Martin
Harmen once said: > It all works fine, just wondering if there's a nicer way to get all > "compilable" packages stored in /vendor. go list ./vendor/... Cheers, Anthony -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

[go-nuts] Re: Go 1.22.0: Alpine: go test with coverage works but returns exit status 1

2024-02-10 Thread Martin
Created a issue based on our discussion: https://github.com/golang/go/issues/65653 On Saturday, February 10, 2024 at 10:49:58 PM UTC+1 Martin wrote: > Hey Aldemar and Thomas, > > thanks for your hints. > > > While trying to upgrade a go package to 1.22.0 today, I ran into

[go-nuts] Re: Go 1.22.0: Alpine: go test with coverage works but returns exit status 1

2024-02-10 Thread Martin
4 > % CVPKG=$(go list ./... | tr '\n' ',') > % go test -coverpkg=${CVPKG} -coverprofile=coverage.out -covermode=count > ./... > (all tests passing) > % echo $? > 0 > On Thursday, February 8, 2024 at 2:41:18 PM UTC-5 Martin Schallnahs wrote: > >> Hey Brian, >>

[go-nuts] Re: Go 1.22.0: Alpine: go test with coverage works but returns exit status 1

2024-02-08 Thread Martin Schallnahs
g errors causing the exit code 1. But it > works fine for me under both Linux and macOS, as long as I have "go 1.22.0" > in go.mod. Maybe someone who knows more about Windows can help? > > On Thursday 8 February 2024 at 17:03:18 UTC Martin Schallnahs wrote: > >> Hi Brian,

[go-nuts] Re: Go 1.22.0: Alpine: go test with coverage works but returns exit status 1

2024-02-08 Thread Martin Schallnahs
But it > works fine for me under both Linux and macOS, as long as I have "go 1.22.0" > in go.mod. Maybe someone who knows more about Windows can help? > > On Thursday 8 February 2024 at 17:03:18 UTC Martin Schallnahs wrote: > >> Hi Brian, >> >> tha

[go-nuts] Re: Go 1.22.0: Alpine: go test with coverage works but returns exit status 1

2024-02-08 Thread Martin Schallnahs
Hi Brian, thanks for checking out, yes that I wanted also to write you. We need it currently in our CI as some dependency scanner tool does not work with the "go X.Y.Z." syntax, but I tried, and for my problem it did not was the cause. > If a test fails, I would expect it to terminate with an

[go-nuts] Re: Go 1.22.0: Alpine: go test with coverage works but returns exit status 1

2024-02-07 Thread Martin
Also this happens with the Alpine based image, but also for the Debian based image as well. On Thursday, February 8, 2024 at 12:43:32 AM UTC+1 Martin wrote: > I am using the new `golang:1.22.0-alpine3.19` Alpine image to build and > test a Golang 1.22.0 application. The test uses coverag

[go-nuts] Go 1.22.0: Alpine: go test with coverage works but returns exit status 1

2024-02-07 Thread Martin
I am using the new `golang:1.22.0-alpine3.19` Alpine image to build and test a Golang 1.22.0 application. The test uses coverage like that `go test -v ./... -coverprofile=coverage.out -coverpkg=./internal/... -covermode count`. The test command seems to work fine, but the exit status is 1. The

Re: [go-nuts] Announcing the tabula backgammon engine

2023-12-07 Thread Martin Schnabel
Hi Trevor, I played two games against the bot and it was fun! Thank you! However, there is a bug in the end game, when collecting pieces, and a go stack trace in the console: panic: no dice roll to use for 7/0 […] code.rocket9labs.com/tslocum/bgammon.(*Game).LegalMoves.func3(0x7, 0x0)

Re: [go-nuts] Re: recommended statistics package? Requirements: ANOVA, Brown-Forsythe

2023-10-23 Thread Martin Schnabel
Hi, I attempted to translate the linked JS implementation for fun. Maybe someone can use it as a starting point and correct or verify its correctness. https://go.dev/play/p/Wrw2yDRof0z Have fun! On 10/23/23 07:38, Jan wrote: hi, I did a quick search and I didn't find anything in Go. But

[go-nuts] Re: map type conversion

2023-07-17 Thread MARTIN RODRIGUEZ-DUQUE (geimel)
https://groups.google.com/g/golang-nuts/c/zarrFbwxejc/m/JLl2WgUqBAAJ On Sunday, July 16, 2023 at 11:02:03 AM UTC-5 Leonard Mittmann wrote: > Hi everyone, I am wondering if there is efficient way to do the following > type conversion (without looping over the map): > > var m = map[uint]uint{

Re: [go-nuts] Map of types?

2023-04-12 Thread Martin Schnabel
Hi Bèrto, as you said, you cannot put a type directly into a map. However you can use package reflect to get type reflection information, that you can put into a map. But in this case I would simple use a map of constructor functions that have a common interface. Like this

Re: [go-nuts] Looking for new project that I can start right now

2023-02-12 Thread Martin Schnabel
Hey Kazuya and everybody, sorry for the noise. Just a quick note to check your spam folder in case you did not already see my previous private messages. Have fun! On 2/12/23 15:13, Kazuya Nomura wrote: Dear, Martin How's your weekend? Thank you for your reply. Could you let me know your

Re: [go-nuts] Looking for new project that I can start right now

2023-02-10 Thread Martin Schnabel
. I take some time today to write up my ideas for subprojects within this context, so we can have a base for discussion. I will send you a link tonight. I'm in the european timezone, if we want to meet on discord. I'm happy you want to join this project idea to learn! Best regards Martin

Re: [go-nuts] Looking for new project that I can start right now

2023-02-10 Thread Martin Schnabel
on your work if I did. But if all the stars align you could help kick start a nice effort. Best regards Martin On 2/10/23 02:38, Kazuya Nomura wrote: I just finished the golang course myself and want to start any project to contribute or start as trial. I don' t want to get client's privacy

Re: [go-nuts] output slice without brackets

2023-01-14 Thread Martin Schnabel
Hi, if you have string slice you can use strings.Join(slice, ", "). Please do send text as text to mailing lists. Hope this helps, have fun! On 1/14/23 09:46, Nuraini putri wrote: Hi, I wanna ask about How to print slice output without brackets? DISCORD.png -- You received this message

Re: [go-nuts] Shellquote in stdlib

2022-12-12 Thread Martin Atkins
I don't think the Go command is using a shell to parse the value of the -gcflags option. I believe that the syntax for this option is handled by an internal function called quoted.Split

Re: [go-nuts] How to cast *interface{} into *T ?

2022-11-25 Thread Martin Schnabel
On 11/25/22 10:55, Denis P wrote: Thank you everyone for your help. The problem still exists. I am looking for a solution where s and s2 point to the same instance. The current example proves they are different instances. https://go.dev/play/p/_JyfJelhIy4 The main goal is to store any type

Re: [go-nuts] Shellquote in stdlib

2022-11-15 Thread Martin Atkins
Indeed, the rules for quoting and parsing command lines are considerably different even in different context on the same OS (Windows) and so successfully building a command line to be run requires detailed knowledge of the context in which it will be evaluated. Unix systems are at least

Re: [go-nuts] What is the best way to write MarshalBinary if the data is a sequence of ints

2022-10-23 Thread Martin Schnabel
hi travis, if you can use any encoding you like, you can write your own custom encoding that uses a varint encoding. the binary encoding interface implies that the framing or length segmenting of the raw bytes happens outside that function, so you can just read and write all your ints using the

Re: [go-nuts] Facing issues while using builtin functions while executing golang templates

2022-10-22 Thread Martin Schnabel
Hi Ritesh, I am no expert on these matters, but have you thought about defective memory on this specific machine? I certainly looks very wrong to me and the first thing i would try is run an extensive memory test. If your systems memory is faulty, then all bets are off and trying to debug

Re: [go-nuts] Issue with go-git API

2022-10-10 Thread Martin Schnabel
Hi PK, most of the time examples are single file programs to be used with go run. if you are inside the module root that covers all the dependencies (or decend into the relevant example folder) you can use `go run main.go` to run the example file. I just tired it with the same repository

Re: [go-nuts] Go routine context

2022-10-01 Thread Anthony Martin
Robert Engels once said: > I think you’ll find the article interesting. It is certainly written > by a CS “god” that knows what he’s talking about. This is the same "god" that said: "Everyone thinks that the concurrency model is Go’s secret weapon, but I think their concurrency

Re: [go-nuts] Re: Error-checking with errors.As() is brittle with regards to plain vs pointer types

2022-09-22 Thread Martin Schnabel
)   if ok {     return err, true    }   return err, false } https://go.dev/play/p/YoIjKtoynuI <https://go.dev/play/p/YoIjKtoynuI> On Thu, Sep 22, 2022 at 11:38 AM Martin Schnabel <mailto:m...@mb0.org>> wrote: Sorry, to barge in but this specific thing is not really an iss

Re: [go-nuts] Re: Error-checking with errors.As() is brittle with regards to plain vs pointer types

2022-09-22 Thread Martin Schnabel
Sorry, to barge in but this specific thing is not really an issue as long as you use the error type as result type. because any value with an Error() string method does implement the error interface. and even an empty struct or a nil pointer to a applicable type will do just fine an matches err

[go-nuts] Re: cannot convert fs.FS zip file to io.ReadSeeker (missing Seek)

2022-09-21 Thread Anthony Martin
Rory Campbell-Lange once said: > interface conversion: *zip.checksumReader is not io.ReadSeeker: > missing method Seek > > Advice on how to rectify this would be gratefully received. Read the entire zip.File into memory with io.ReadAll and create a bytes.Reader with the resulting byte slice.

Re: [go-nuts] Assigning struct values

2022-09-08 Thread Martin Schnabel
Hi Mustafa, this can be easy if you put a pointer value of type *TypeOfStruct into the interface. interface values of structs end up using pointers underneath anyway so there is no performance reason not to. The explanation is that if you type assert to TypeOfStruct, you copy out that plain

Re: [go-nuts] Using Go Lang as a tiny server program at localhost , won't execute request

2022-08-05 Thread Martin Schnabel
hi john, other than php, go programs are compiled to an executable that can then be run. you can not put go files in a folder and expect that to work. you probably followed a tutorial to set up a go http server with a simple route. the reason you get that idea that you can use file names

Re: [go-nuts] Golang import issue .

2022-07-20 Thread Martin Schnabel
Hi Sunday, please do send neither screenshots nor zipped project folders to a mailing list of thousands. My guess is that your projects go.mod file does not declare your project name to be movie_project. In any case it would be helpful for you to follow a hello world tutorial:

Re: [go-nuts] Best way of implementing generic binary search?

2022-07-19 Thread Martin Schnabel
Hi, there is an experimental package golang.org/x/exp/slices which has a generic binary search. I have not much to add but hope it helps. https://pkg.go.dev/golang.org/x/exp/slices https://cs.opensource.google/go/x/exp/+/79cabaa2:slices/sort.go;l=64 On 7/19/22 14:53, Slawomir Pryczek wrote: Hi

Re: [go-nuts] ListenAndServeTLS() (pem and key files for private network)

2022-06-30 Thread Martin Schnabel
Sorry, i may have misunderstood the private network part, hope my answer was helpful anyway. My usecase was a local area network without a fixed ip or dns names, like common home network appliances. I thought about using client certificates too, but decided it would be easier to use common

Re: [go-nuts] ListenAndServeTLS() (pem and key files for private network)

2022-06-28 Thread Martin Schnabel
Martin, How does localca handle CORS? Originally I defined an handler and pass it as a parameter to ListenAndServeTLS c := cors.New(cors.Options{         AllowedOrigins:   []string{"*"},         AllowedMethods:   []string{"GET", "PUT", "POST", "

Re: [go-nuts] ListenAndServeTLS() (pem and key files for private network)

2022-06-28 Thread Martin Schnabel
hi hugh, i played around with the same idea six years ago, resulting in https://github.com/mb0/localca it will use a self signed root cerificate and creates new child certificates specific to the requested hostname, be it an ip or a name like my_local.box i haven't tested it for awhile,

Re: [go-nuts] Generics

2022-05-27 Thread Martin Schnabel
not versed enough in go generics to know the solution, but would propose to take a simpler approach if possible. On 5/27/22 18:24, Martin Schnabel wrote: how about https://go.dev/play/p/YXOTLKpvXNI using json unmarshal directly and without using binary marshaller. or even https://go.dev/play

Re: [go-nuts] Generics

2022-05-27 Thread Martin Schnabel
how about https://go.dev/play/p/YXOTLKpvXNI using json unmarshal directly and without using binary marshaller. or even https://go.dev/play/p/GFE3rnyx9f8 without the endpoint abstraction. or maybe explain what you want to achieve other than unmarshalling a json payload? best regards On

[go-nuts] Re: RFC: function or interface?

2022-03-31 Thread Martin Atkins
>From the perspective of "what difference would it make" the only thing that comes immediately to my mind is that if you return an interface type that is designed so that only types in your own package can or need to implement it then you could potentially add other methods to it in future

Re: [go-nuts] How Does This Work?

2022-03-06 Thread Martin Schnabel
one important detail i have not found in the other answers is that stat is declared to return a fs.FileInfo, but printf takes an empty interface argument and therefor unwraps the interface value. so if you want to print the actual variable type of interface variables you can pass a pointer (same

[go-nuts] Re: Information for gophers in Ukraine

2022-02-26 Thread Anthony Martin
Yes, let's support everyone! If any gopher from the DNR or LNR is tired of their plight being ignored and wants to chat with a friendly US citizen from California, feel free to email me. Anthony -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Re: Questions about documentation of Go standard library

2021-10-08 Thread Martin Schnabel
Hi Kamil, you can probably read it as Invalid argument index or invalid use of argument index. Hope that helps. On 10/9/21 12:33 AM, Kamil Ziemian wrote: Hello, I now read documentation of "fmt" package and in "Format errors" (https://pkg.go.dev/fmt@go1.17.2#hdr-Format_errors) we have

Re: [go-nuts] Trouble with pgx package

2021-10-02 Thread Martin Schnabel
as http.HandlerFunc to pass to a router or mux. Have fun! On 10/2/21 3:53 PM, Martin Schnabel wrote: Hi Денис, QueryRow does not return an error but a Row that you then call Scan on which returns an error. https://pkg.go.dev/github.com/jackc/pgx/v4#Conn.QueryRow You usually call it in combination with scan

Re: [go-nuts] Trouble with pgx package

2021-10-02 Thread Martin Schnabel
Hi Денис, QueryRow does not return an error but a Row that you then call Scan on which returns an error. https://pkg.go.dev/github.com/jackc/pgx/v4#Conn.QueryRow You usually call it in combination with scan. err := QueryRow(`…`).Scan() Have fun! On 10/2/21 12:52 PM, Денис Мухортов wrote:

Re: [go-nuts] Question on handling Data Race

2021-09-12 Thread Martin Schnabel
hi Michael, from my understanding: if you only call refresh from somefunc and locking the body should be fine. however i strongly advise not to export refresh, otherwise it is a broken api. and someone, someday will call refresh without that lock. if refresh should be part of the accessible

Re: [go-nuts] Why do I get multiple times the same data?

2021-07-29 Thread Martin Schnabel
hey, your playground link does not compile! therefor you get a rot13 version of the fixed playground link: uggcf://cynl.tbynat.bet/c/_wwLujQtms- ;) Well who wants to be mean. Just move your buffer declaration into the for loop or reset it: https://play.golang.org/p/hGovCri02lc have fun On

Re: [go-nuts] I think I found a bug?

2021-05-26 Thread Martin Schnabel
Could you send a https://play.golang.org/ link showing a short example? Without much information it sounds like a you update the same slice at two different indices. It would be interesting to know how you populate the temp slice. On 27.05.21 01:52, John Olson wrote: I have a recursive

Re: [go-nuts] How to cast a multi-value?

2021-05-19 Thread Martin Leiser
Assigning string values to string values or byte[] to byte[] does not require additional memory allocation. But conversion between string and byte[] does so most of the time, because the underlying array of a string is immutable, versus the mutable of a byte[]. Encapsulating the type cast

Re: [go-nuts] Search for directory named BigZoom and list contents.

2021-05-10 Thread Martin Schnabel
hi Adam, you call ReadDir with the file name and not with the full path or the path relative to your current working directory. that means you will try to read the dir with path "BigZoom" two times. the WalkDirFunc passes a path argument that concatenates the path prefix with the dir entry

Re: [go-nuts] go text://protocol client?

2021-04-10 Thread Anthony Martin
Jesper Louis Andersen once said: > On Fri, Apr 9, 2021 at 5:37 PM 'Petite Abeille' via golang-nuts < > golang-nuts@googlegroups.com> wrote: > > > > Would you know of any go text://protocol clients? Or servers? > > > > > No, but it would be a fairly good beginner project[0] > > [0] Readers of the

[go-nuts] Re: Releasing a V2 module and interacting with git branches

2021-04-08 Thread Martin Atkins
I had some experiences with doing this sort of thing for what eventually became github.com/hashicorp/hcl/v2. I have some assorted notes to share about that experience, which I hope will substitute for a more definitive answer to your question "does this sound reasonable?", because I don't feel

Re: [go-nuts] Type parameters syntax... Can it be improved?

2021-03-25 Thread Martin Leiser
Type inferences helps, but weakens the quality of error messages. So please always allow for a explicit type parameter annotation even if inference is possible. (And doing so in a more global location may improve simplicity a lot;-) Martin > Ian > > > > On Tuesday

[go-nuts] Re: A message from the CoC committee

2021-03-23 Thread Anthony Martin
can...@google.com once said: > After review, permanent bans were given to multiple individuals, with no > possibility for appeal. Further corrective actions like temporary bans and > final warnings are being deliberated, pending further investigation. Where is the moderation log? Anthony --

Re: [go-nuts] No Generics - Type Binding on Imports

2021-03-22 Thread Martin Leiser
Am 22.03.2021 um 10:10 schrieb Martin Leiser: Am 21. März 2021 22:01:38 MEZ schrieb Ian Lance Taylor : On Sun, Mar 21, 2021 at 1:02 PM Martin Leiser wrote: ... import "container/list" stringlist type ElementType = string What if I want to have a list of lists

Re: [go-nuts] No Generics - Type Binding on Imports

2021-03-22 Thread Martin Leiser
Am 21. März 2021 22:01:38 MEZ schrieb Ian Lance Taylor : >On Sun, Mar 21, 2021 at 1:02 PM Martin Leiser >wrote: >> >> I think so. But How? Remember we need to do two things: >> >> - A way to define type parameters. >> >> - A way to bind the ty

[go-nuts] No Generics - Type Binding on Imports

2021-03-21 Thread Martin Leiser
" yet, but it should be possible to add this for typical functional libraries such as "sort.go <https://golang.org/pkg/sort/>".    - type bindings my even be transitive, if the binding type is itself a exported interface type. So the a full fledged proposal may end up a

Re: [go-nuts] No generic, part -2

2021-03-13 Thread Martin Schnabel
n them now? On 13.03.21 14:09, Jan Mercl wrote: On Sat, Mar 13, 2021 at 1:44 PM Martin Schnabel wrote: as far as i know there is no reason that anybody has to write code with generics when they are available. therefor i really don't understand the negative mails to this list. That nonchalantly ignores

Re: [go-nuts] No generic, part -2

2021-03-13 Thread Martin Schnabel
(sorry space a, i didn't reply to list) hi alex and space a. as far as i know there is no reason that anybody has to write code with generics when they are available. therefor i really don't understand the negative mails to this list. do you also want others not to use them? how would that

[go-nuts] Re: [security] Go 1.16.1 and Go 1.15.9 are released

2021-03-11 Thread Anthony Martin
Katie Hockman once said: > The Reader.Open API, new in Go 1.16, will panic when used on a ZIP archive > containing files that start with “../”. > > This issue is CVE-2021-27919 and Go issue golang.org/issue/44916. Should I submit a CVE request for the power switch on my server? Prodding it with

[go-nuts] Re: Golang mentioned on Penn and Teller: Fool Us?

2021-03-04 Thread Anthony Martin
https://www.bell-labs.com/usr/dmr/www/labscam.html Cheers, Anthony -- 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] Go Documentation for private github projects

2021-02-20 Thread Martin Schnabel
Hi, this January a fork of gddo was was announced to this list. Take a look https://godocs.io/ Best regards On 20.02.21 08:13, Sankar P wrote: Hi We have a bunch of private repos in github with Go sources. We want to see the documentation for these repository sources in an easy to click URL.

Re: [go-nuts] [generics] notes on adding generics to a package

2021-02-08 Thread Martin Leiser
xis generic collections are the far more important aspect than functional libraries containing "Min" and "Max" functions. And your writing was all about collections too. Thank a lot for Your suggestions! Martin Leiser On Sun, Feb 7, 2021 at 9:20 PM Martin Leiser <mailt

Re: [go-nuts] [generics] notes on adding generics to a package

2021-02-07 Thread Martin Leiser
he types you actually want to use with them with. It is a simple "opt in" approach. You add a type binding on import, that's it. For the "generic" type in the package: Give a name to your types, which helps for readability anyway. And big thanks for your good writeup of the ex

Re: [go-nuts] Possible Go 2 proposal for built-in Remove method for Slices.

2021-02-06 Thread Martin Schnabel
On 06.02.21 03:32, Wojciech S. Czarnecki wrote: Dnia 2021-02-04, o godz. 00:30:57 Selahaddin Harmankaya napisał(a): There are obviously more things to consider Slice is not an array, it is a _view_into_ an array. Many such views into the same array may exist simultaneously. A "remove

[go-nuts] init() in package main won't run :-/

2021-01-12 Thread Martin Ziebiker
Hello, please does anyone know why init() won't run? Thank You very much! https://play.golang.org/p/0PDUJlF8X1w -- 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] Generics - please provide real life problems

2020-12-31 Thread Martin Schnabel
hi Space, i do not care about this discussion in general and learned to trust the go developers to be thoughtful and reasonable. i wouldn't write this normally, but in case you are not aware it might actually help: i did read the last couple of your messages to this list again and came to

Re: [go-nuts] json objects

2020-12-26 Thread Martin Schnabel
hi hamsa, first of all: it is usually frowned upon to send text as pictures. so please copy text as text in the future. the are people with terminal mail clients or visually impaired using screen readers. the data in your example is neither valid json value nor a valid json stream. either

[go-nuts] Re:Generics - please provide real life problems

2020-12-25 Thread Martin Hanson
Your patience is inspiring! Thank you! -- 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 the

[go-nuts] Re: Generics - please provide real life problems

2020-12-25 Thread Martin Hanson
> You are repeatedly starting new threads, keeping the same subject as already > existing ones. > Don't do that please, if you respond to a certain topic keep the thread > intact. > > That way all the conversation is in a single place. What are you on about!? This is my second post on this

Re: [go-nuts] Re: Generics, please go away!

2020-12-24 Thread Anthony Martin
> Tasteless attempt at humour. Our collective taste is ruined by the anosmia of a contemporary disease. Anthony -- 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

[go-nuts] Re: Generics - please provide real life problems

2020-12-24 Thread Martin Hanson
I have found this extremely useful (was posted on GitHub) and I post this for any latecomers to this thread some time in the future: https://github.com/golang/go/wiki/ExperienceReports#generics Especially this document:

[go-nuts] Re: Generics - please provide real life problems

2020-12-24 Thread Martin Hanson
@Ian Lance Taylor, I feel I must apologize to you. I have just hunted down every single mailing list post from you regarding the generics issues and I have found that you have been extremely balanced and very much protecting the Go philosophy and wanting to avoid any added complexity etc. I am

Re:[go-nuts] Generics - please provide real life problems

2020-12-23 Thread Martin Hanson
Oh, I almost forgot, it also clearly does not "have minimal impact on everybody else", which is another proposal selection criteria. Go code becomes much more complex to read and understand from all the examples I have seen. You can even find several YouTube videos with people trying to analyze

Re:[go-nuts] Generics - please provide real life problems

2020-12-23 Thread Martin Hanson
I write this from my understanding of the "Proposal selection criteria", which clearly states, that in order for a proposal to be accepted, it has to "address an important issue for many people". This is why I'm asking for real life problem examples, not theoretical ones. I do not believe that

Re:[go-nuts] Generics - please provide real life problems

2020-12-23 Thread Martin Hanson
I'm sorry, but this is not real life problems. This is exactly the problem with this proposal. It's based on nothing but small theoretical examples. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] Generics - please provide real life problems

2020-12-23 Thread Martin Hanson
I have been arguing passionately against adding generics to Go because I truly believe that it is going against the simplicity of Go and the philosophy behind the design of Go. I believe that the resilience of Go against unnecessary change is of vital importance. The experience provided by Ken

[go-nuts] Re: Generics, please go away!

2020-12-23 Thread Martin Hanson
@Alex Besogonov: > Can you provide concrete examples of code that would become more > complicated and/or slower with the addition of generics? I'm > genuinely researching it. I'm not the one wanting to change the language, it's the other way around. You have to provide concrete examples of why

[go-nuts] Re: Generics, please go away!

2020-12-22 Thread Martin Hanson
> Ultimately Go is a community and polls are unavoidable. And even in > the benevolent-dictator model, the dictator is forced by the > community if the pressure is high enough, this has happened in a lot > of projects like Vim and Python. And in Vim some changes only > happened after the adoption

[go-nuts] Re: Generics, please go away!

2020-12-22 Thread Martin Hanson
@Ian, if you're succumbing to outside pressure, please don't. If you on the other hand is pro-generics to Go, then of course that is your right. I for one doesn't hope that the future of Go is going to continue down this road, with new proposals for change popping up on GitHub every other day

[go-nuts] Re: Generics, please go away!

2020-12-22 Thread Martin Hanson
> He did explicitly said in the last paragraph that Go is not driven by > pools (aka surveys). Please re-read! The problem is that his post is quite contradictory. On the one hand he states that "Go is not and never has been a poll-driven language", yet at the same time, "I think it's reasonable

[go-nuts] Re: Generics, please go away!

2020-12-22 Thread Martin Hanson
> I don't know of a poll specifically about generics. But for the past > several years we've done a Go community survey, and every year there > is significant support for adding generics to the language. So Ian, what you're saying is that for the future we can expect that future development of Go

Re: [go-nuts] Re: Generics, please go away!

2020-12-22 Thread Anthony Martin
'Axel Wagner' via golang-nuts once said: > What isn't welcome is your attempt of alienating people with a different > viewpoint from yours and make them feel unwelcome. And if you continue to > insist on doing that, the community *will* ask you to leave. Please don't minimize or silence the

[go-nuts] Re: Generics, please go away!

2020-12-22 Thread Martin Hanson
No polls. It's not a matter of majority rule! It's a matter of understanding why generics was left out of Go from the start, like classes was left out of Go. If we start adding stuff that the original developers of Go left out by purpose, we're not understanding the design choices that went into

[go-nuts] Re: Generics, please go away!

2020-12-21 Thread Martin Hanson
I have just suggested the same thing @Space A, before I read your message and I agree fully! https://github.com/golang/go/issues/15292#issuecomment-749032046 I strongly believe we need to fork Go if generics gets added and then let the toy people have their new shiny things in Go while we

[go-nuts] Generics, please go away!

2020-12-20 Thread Martin Hanson
I think people who want generics added to Go should go and program in Java or C++. Adding generics to Go will ruin the beautiful simplicity of the language and I haven't found a single example in which adding generics to Go pays off. Even with the examples of having two almost identical

[go-nuts] Re: implementing macro in plan 9 assembly

2020-10-15 Thread Anthony Martin
saurav deshpande once said: > How to implement macro in plan9 assembly? I read the documentation of > plan9 assembly but could not find it. Is there any alternative for > macro in plan9? Assembly language source files are preprocessed just like C source. The familiar #define and #include

Re: [go-nuts] handling database.Query empty set

2020-09-13 Thread Martin Schnabel
other questions yourself as well. have fun! On 13.09.20 10:19, Andy Hall wrote: thanks martin...it seems with no query handling the database Next func does not run anyway as the rows evaluate to false in the for loop... // tell other players in the room you have entered rows_users, err

Re: [go-nuts] handling database.Query empty set

2020-09-12 Thread Martin Schnabel
hi Andy, when you take a look at the documentation of the Rows type returned by Query you will see a helpful example of its common use, appending the scanned results into a slice. my recommendation would be to follow this example and then check if the len(slice) == 0 to detect an empty set.

Re: [go-nuts] writing to net.Conn tcp socket

2020-09-12 Thread Martin Schnabel
Hi Andy, a global map is the way to go, however writing an reading the map from multiple go routines will fail (in your case different handle calls for connections) because the map data structure is not safe for concurrent use and must be coordinated. the way it is usually solved is by adding

Re: [go-nuts] Newbie question about type-casts

2020-08-04 Thread Martin Møller Skarbiniks Pedersen
> > On Sun, Aug 2, 2020 at 2:09 PM Martin Møller Skarbiniks Pedersen < > traxp...@gmail.com > wrote: > >> I have written my first little piece of Go-code. >> However it took some time and code for me to divide a int64 by 4 and >> round down. >> >>

Re: [go-nuts] Newbie question about type-casts

2020-08-04 Thread Martin Møller Skarbiniks Pedersen
> > On Sun, Aug 2, 2020 at 2:09 PM Martin Møller Skarbiniks Pedersen < > traxp...@gmail.com > wrote: > >> I have written my first little piece of Go-code. >> However it took some time and code for me to divide a int64 by 4 and >> round down. >>

[go-nuts] Newbie question about type-casts

2020-08-02 Thread Martin Møller Skarbiniks Pedersen
I have written my first little piece of Go-code. However it took some time and code for me to divide a int64 by 4 and round down. How can the last two lines be rewritten? Regards Martin package main import ( "fmt" "bufio" "math" ) var cash int64 scanne

Re: [go-nuts] builtin function definitions

2020-07-29 Thread Martin Schnabel
The linked spec is the the definitive language specification. I read it carefully a couple of time (cannot recommend it enough) and knew about type switches. The most common language implementation is go's default compiler gc. Which is the place to implement the language spec and type

Re: [go-nuts] builtin function definitions

2020-07-29 Thread Martin Schnabel
This is a special kind of switch called a type switch. You can read more about it in the language specification where its part of the intrinsic go syntax. https://golang.org/ref/spec#Switch_statements Because it is a special language construct you need to look at the compiler. You probably

Re: [go-nuts] Busy synchronization wait seems to behave differently on 1.13 and 1.14

2020-07-25 Thread Martin Schnabel
I am not certain but the reason probably is the change to go-routine preemption in 1.14. From https://golang.org/doc/go1.14#runtime … Goroutines are now asynchronously preemptible. As a result, loops without function calls no longer potentially deadlock the scheduler or significantly delay

[go-nuts] [generics] Trying to use generics as enums

2020-07-05 Thread Martin Tournoij
playground today. Note I am not usually subscribed to the golang-nuts mailing list, and have not read all of the discussions (using Google groups to browse archives is a but of a pain), so apologies if this duplicates any previous feedback. Hope it helps. Cheerio, Martin --- First, let's defin

Re: [go-nuts] Weird benchmark results for seemingly identical functions

2020-06-22 Thread Martin Schnabel
Let me quickly point out that your logic is inverted in the second code snippet because you break on the condition. That is most likely the reason for the difference. I guess the second example exits on the first iteration. for pos := 0; true; pos++ { if pos < suffixLen && pos <

Re: [go-nuts] Weird slice of struct

2019-12-04 Thread Martin Schnabel
On 04.12.19 22:40, cstige...@gmail.com wrote: Hello Golang nuts group. I've tested golang's slice and got a weird result. Anyone can explain it? the variable ss in the for range loop is one and the same variable, with a different value of AA for each iteration. it has only one address.

[go-nuts] Re: mutual TLS authentication (sometimes)

2019-11-20 Thread Anthony Martin
Matthew Zimmerman once said: > I've also thought about authenticating on a different domain name > auth.service then redirecting to data.service or something like that where > the cookie would be issued to the *.service domain, however that's still > one tls.Config and using SNI with

[go-nuts] Re: [security] Go 1.13.2 and Go 1.12.11 are released

2019-10-18 Thread Anthony Martin
Katie Hockman once said: > The Go 1.13.2 release also includes a fix to the compiler that prevents > improper access to negative slice indexes in rare cases. Affected code, in > which the compiler can prove that the index is zero or negative, would have > resulted in a panic in Go 1.12.11, but

Re: [go-nuts] Interface method return other interface?

2019-10-10 Thread Martin Palma
s one point you need to remember when returning interfaces: > > make sure you handle nil correctly: > > > > type S struct {} > > > > type I interface {} > > > > func f() *S { > > return nil > > } > > > > func g() I { > > x:=f()

[go-nuts] Interface method return other interface?

2019-10-09 Thread Martin Palma
I'm wondering If it is ok (or good Go code) if an interface method returns an other interface? Here an example: type Querier interface { Query() string } type Decoder interface { DecodeAndValidate() Querier } -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] JWT validation only in Middleware

2019-09-27 Thread Martin Palma
wrote: > On Thu, Sep 26, 2019 at 1:14 PM Martin Palma wrote: > > > > Hello, > > > > I'm in the process of writing an HTTP API with Go. I use a middleware > for generating and validating JWT tokens. On any incoming request the > middleware checks the JWT and validates i

  1   2   >