Re: [go-nuts] Why is it forbidden to add methods to an existing type?

2022-03-31 Thread Zhaoxun Yan
Hi Sam! Your solution does not seem to work: package main import( "fmt" "strconv" ) type String struct{string} func (s String) print(){ fmt.Println(s) } func main() { var a String ="hello, world\n" a.print() fmt.Println(strconv.ParseInt("78",10, 64)) var x

[go-nuts] Is it possible to change the existing printline dynamically in golang?

2022-03-31 Thread Zhaoxun Yan
I just noticed how python pip upgraded from printing numerous process bars like this: ■■■ 30% completed 40% completed ■■60% completed 80% completed ■■ 100% completed to a single line of a growing bar and changing decla

Re: [go-nuts] Re: autoremove unviolated precondition checks at compile time

2022-03-31 Thread Henry
You only need to validate in Mul and Add. They are the ones that work directly with the slices and know the reason behind such requirements. Muladd only needs to check for any error returned by either Mul or Add. In the future, if the requirement changes in either Mul or Add, you don't need to

[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 witho

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

2022-03-31 Thread burak serdar
On Thu, Mar 31, 2022 at 1:14 PM Adam Pritchard wrote: > I’m working on a library to help get the “real” client IP from HTTP > requests: > https://github.com/realclientip/realclientip-go > https://pkg.go.dev/github.com/realclientip/realclientip-go > > Right now the “strategies” are like: > > type

[go-nuts] Re: go mod tidy doesn't rewrite go.mod file (shows go: warning "all" matched no packages)

2022-03-31 Thread vaastav...@gmail.com
Here are the contents of the go.mod file ``` module module_name_obfuscated go 1.18 require ( github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b github.com/go-redis/redis/v8 v8.11.4 github.com/go-sql-driver/mysql v1.6.0 github.com/otiai10/copy v1.7.0 github.com/

Re: [go-nuts] How to contribute to /x/ ?

2022-03-31 Thread Jen Zarzycki
I didn't find a proposal for it, so I submitted one here: https://github.com/golang/go/issues/52085 I added a link on it to the discussion thread Alex provided. Thank you both! On Thursday, March 31, 2022 at 11:57:40 AM UTC-7 axel.wa...@googlemail.com wrote: > General information on how to co

Re: [go-nuts] Printing Documents with Go?

2022-03-31 Thread Argyris Prosilis
Hello, I'm using the package https://github.com/alexbrainman/printer but I have an issue with printing Greek characters. Does anyone have any suggestion? Thank you, Argyris On Friday, May 10, 2013 at 5:36:01 AM UTC+3 brainman wrote: > On Friday, 10 May 2013 00:16:29 UTC+10, Kul wrote: > > >

[go-nuts] RFC: function or interface?

2022-03-31 Thread Adam Pritchard
I’m working on a library to help get the “real” client IP from HTTP requests: https://github.com/realclientip/realclientip-go https://pkg.go.dev/github.com/realclientip/realclientip-go Right now the “strategies” are like: type Strategy func(headers http.Header, remoteAddr string) string ... cl

Re: [go-nuts] How to contribute to /x/ ?

2022-03-31 Thread 'Axel Wagner' via golang-nuts
General information on how to contribute to the Go project (which includes /x/…) is in the contribution guide: https://go.dev/doc/contribute But yes, as Jan mentions, the starting point (as is also mentioned there) is to open a proposal. FWIW, I believe that the Go team is aware of the want of a g

Re: [go-nuts] How to contribute to /x/ ?

2022-03-31 Thread Jan Mercl
On Thu, Mar 31, 2022 at 8:42 PM Jen Zarzycki wrote: > I'd like to submit an implementation of sync.Map (using generics) to the > golang.org/x/sync repo. If you want to propose an API change, please start by submitting a proposal here: https://github.com/golang/go/issues, thanks. -- You receiv

[go-nuts] How to contribute to /x/ ?

2022-03-31 Thread Jen Zarzycki
I'd like to submit an implementation of sync.Map (using generics) to the golang.org/x/sync repo. Would someone please point me in the right direction? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop recei

[go-nuts] Re: go mod tidy doesn't rewrite go.mod file (shows go: warning "all" matched no packages)

2022-03-31 Thread Brian Candler
Can you show the contents of the go.mod file in the directory where you run "go mod tidy"? > I get this error when I run `go list all` as well. Try "go list" rather than "go list all" (because in that context, "all" is interpreted as the name of a package) On Thursday, 31 March 2022 at 16:12:2

[go-nuts] go mod tidy doesn't rewrite go.mod file (shows go: warning "all" matched no packages)

2022-03-31 Thread vaastav...@gmail.com
Hi all, I am encountering this problem where when I run `go mod tidy`, it simply returns `go: warning: "all" matched no packages`. I get this error when I run `go list all` as well. I was hoping someone could help me as to why this is happening since I haven't been able to find an explanation f

Re: [go-nuts] Re: autoremove unviolated precondition checks at compile time

2022-03-31 Thread 'Axel Wagner' via golang-nuts
There is a concept called "dependent types", which is more or less this. Wikipedia has a good overview of languages with dependent types: https://en.wikipedia.org/wiki/Dependent_type#Comparison_of_languages_with_dependent_types That being said, it's pretty complex stuff. On Thu, Mar 31, 2022 at 1:

Re: [go-nuts] Re: autoremove unviolated precondition checks at compile time

2022-03-31 Thread Toon Knapen
> > > What you need is a prover that understands the facts holding up the > callers' stack and can statically detect tautologies in the calees > checks. Not trivial, but I believe it would be a ton of fun to write > ;-) Indeed, that is what I want to achieve. Are there any of these tools al

Re: [go-nuts] Re: autoremove unviolated precondition checks at compile time

2022-03-31 Thread Jan Mercl
On Thu, Mar 31, 2022 at 10:01 AM Toon Knapen wrote: > but that would enable or disable _all_ precondition checks. Sure, that's the point. Henry used the +build debug mechanism, so the checks would be disabled in production. If one wants the checks to be always present there's no need to use a de

[go-nuts] Re: autoremove unviolated precondition checks at compile time

2022-03-31 Thread Toon Knapen
but that would enable or disable _all_ precondition checks. What I am looking for is soth. smart enough that deduces that the precondition checks in `mul` and `add` can be removed because of the precondition check in `Muladd`. On Thursday, March 31, 2022 at 5:26:44 AM UTC+2 Henry wrote: > You

Re: [go-nuts] Allow a TCP connection, but not a TLS connection based on an ACL

2022-03-31 Thread Diego Joss
Hi John, On Mon, Mar 28, 2022 at 11:26 PM John wrote: > I'm looking to satisfy this: > >- If you are in an ACL, you can make a TLS connection > > >- If you are not in an ACL, you can only a TCP connection, but not a >TLS connection* > > * It would be better if it didn't honor TCP eit