Re: [go-nuts] Possible to make base64 pick the decode encoding automatically?

2021-02-02 Thread hey...@gmail.com
> So having a “meta/relaxed decoder” usually leads to specification/interoperability/security problems down the road I respectfully disagree. Since it's only relaxed with regard to decoding, it follows the robustness principle where you be liberal in what you accept. Within a system, the

[go-nuts] Re: Contributing to golang based project on github - collaboration best practice

2021-02-02 Thread Volker Dobler
You either have to use the "replace" directive in go.mod, or: Do not work on the fork. Do your work on a plain _clone_ of the repo (which works without "replace"ing dependencies). To create a Github PR: git push to your fork (add it as an additional git remote) and create the PR. The "fork" is

Re: [go-nuts] Possible to make base64 pick the decode encoding automatically?

2021-02-02 Thread robert engels
Sorry it just doesn’t “feel right”. There are different encoding scheme as laid out in the RFC. and other RFCs that cover their uses. If you have a system that states “send us Base64 data” it is poorly specified - better to state,

Re: [go-nuts] Contributing to golang based project on github - collaboration best practice

2021-02-02 Thread Shulhan
> On 3 Feb 2021, at 10.17, Nicholas Yue wrote: > > Hi, > > I am relatively new to golang coming from a C++/Python world. > > When contributing to C++/Python projects on GitHub, I usually fork the > project, make changes to hit and submit a pull request to the > author/maintainer. > >

[go-nuts] Contributing to golang based project on github - collaboration best practice

2021-02-02 Thread Nicholas Yue
Hi, I am relatively new to golang coming from a C++/Python world. When contributing to C++/Python projects on GitHub, I usually fork the project, make changes to hit and submit a pull request to the author/maintainer. I found that the above didn't work for me. I am hoping to

Re: [go-nuts] Possible to make base64 pick the decode encoding automatically?

2021-02-02 Thread hey...@gmail.com
Your translate reader works really well, thanks for sharing it. I have seen code that tried to decode base64 four times in the wild, which led me to posting this, hope something like this could be incorporated into the standard library. On Tuesday, February 2, 2021 at 8:50:08 PM UTC+8 rog

Re: [go-nuts] Re: C function return value of type float changes when used with COG

2021-02-02 Thread Alex
You need to provide a complete runnable example, the sniplet you provided is missing all the interesting parts. On Tuesday, 2 February 2021 at 3:58:39 pm UTC+8 Robert M. Münch wrote: > > Here we go: https://pastebin.com/6c6rq92K > > The code to access the C lib was generated with c-for-go, so

Re: [go-nuts] go.mod: 1: module: not found

2021-02-02 Thread saurav deshpande
Okay, will try with a different approach Thank you On Wed, 3 Feb, 2021, 1:43 am Ian Lance Taylor, wrote: > On Tue, Feb 2, 2021 at 11:16 AM saurav deshpande > wrote: > > > > I tried by giving the module name as pathname by pushing the code to git > and created go.mod using that path, but still

Re: [go-nuts] go.mod: 1: module: not found

2021-02-02 Thread Ian Lance Taylor
On Tue, Feb 2, 2021 at 11:16 AM saurav deshpande wrote: > > I tried by giving the module name as pathname by pushing the code to git and > created go.mod using that path, but still gives the same error. I'm sorry that didn't help, but I still expect that the problem is that "go build -n" is

Re: [go-nuts] go.mod: 1: module: not found

2021-02-02 Thread saurav deshpande
I tried by giving the module name as pathname by pushing the code to git and created go.mod using that path, but still gives the same error. Thank you On Tuesday, February 2, 2021 at 5:33:27 AM UTC+5:30 Ian Lance Taylor wrote: > On Mon, Feb 1, 2021 at 1:42 PM saurav deshpande > wrote: > >

Re: [go-nuts] Go Create

2021-02-02 Thread Kevin Chadwick
> >> Note, that this is essentially one of the workflows suggested here (which I >> would consider the canonical documentation for the "eng org wants to onboard >> Go" case): >> https://golang.org/ref/mod#private-modules > > I have realised a goproxy may be needed rather than a http server as I

Re: [go-nuts] Possible to make base64 pick the decode encoding automatically?

2021-02-02 Thread 'Axel Wagner' via golang-nuts
On Tue, Feb 2, 2021 at 6:43 PM Robert Engels wrote: > What “padding” are you referring to? Each must be 2 characters. And there > is a standard that covers this https://tools.ietf.org/html/rfc4648 > Yes, there indeed is. Section 5 describes a second encoding scheme, used for URLs and the like.

Re: [go-nuts] Re: Virtual time for testing

2021-02-02 Thread Christian Worm Mortensen
Hi Roger, Thank you for sharing how you have solved the problem in the past and the problems you have had. As I see it, my proposal would solve your problem perfectly in many cases without the need to keep track of anything. If you like it, it may be helpful to express your support:

Re: [go-nuts] Possible to make base64 pick the decode encoding automatically?

2021-02-02 Thread Robert Engels
What “padding” are you referring to? Each must be 2 characters. And there is a standard that covers this https://tools.ietf.org/html/rfc4648 > On Feb 2, 2021, at 10:57 AM, 'Axel Wagner' via golang-nuts > wrote: > >  > Rogers approach seems like the best one to me - wrap the input in a custom

Re: [go-nuts] Possible to make base64 pick the decode encoding automatically?

2021-02-02 Thread 'Axel Wagner' via golang-nuts
Rogers approach seems like the best one to me - wrap the input in a custom `io.Reader` that transparently replaces `-_` with `+/` respectively (and drop trailing `=`). The bufio approach doesn't work, because there is no guarantee that one of the distinguishing characters is early in the stream

Re: [go-nuts] Possible to make base64 pick the decode encoding automatically?

2021-02-02 Thread Amnon
Reading through a bufio.Reader is often useful for these situations. You can peek the beginning of the input in order to decide which decoder to use. Another option is to use the io.TeeReader to duplicate the reader, and then send one copy to each decoder. One will succeed, and give you the

Re: [go-nuts] Possible to make base64 pick the decode encoding automatically?

2021-02-02 Thread 'Axel Wagner' via golang-nuts
This question isn't about the decoded data, but about *which* base64 format is used - i.e. if it uses padding or not and what 2 characters are used outside of a-zA-Z0-9. The most common ones use +/ and -_, so it's easy to tell which is used and just accept either (and padding can be viewed as

Re: [go-nuts] Possible to make base64 pick the decode encoding automatically?

2021-02-02 Thread Robert Engels
Base64 is always ASCII. The encoded data may be in an arbitrary format. You need to pass additional metadata or try and detect its encoding. > On Feb 2, 2021, at 6:50 AM, roger peppe wrote: > >  > In case you find it helpful, here's a clone of the base64 command that I > wrote in Go. I did

Re: [go-nuts] Possible to make base64 pick the decode encoding automatically?

2021-02-02 Thread roger peppe
In case you find it helpful, here's a clone of the base64 command that I wrote in Go. I did it precisely because I wanted to be able to decode any encoding scheme interchangeably. https://github.com/rogpeppe/misc/blob/master/cmd/base64/base64.go I agree that it might be useful to have some of

[go-nuts] Possible to make base64 pick the decode encoding automatically?

2021-02-02 Thread hey...@gmail.com
Hi, I have an io.Reader whose content is encoded in base64 with encoding type unknown. Since there shouldn't be any ambiguity between the two, is it possible to make the base64 automatically pick the right one to decode? Currently I have to read everything out to pin down the encoding, which

Re: [go-nuts] How to improve the parallelism of go routine?

2021-02-02 Thread 颜文泽
ok 在2021年2月2日星期二 UTC+8 下午4:24:12 写道: > On Mon, 2021-02-01 at 23:48 -0800, 颜文泽 wrote: > > This is my code: > > 2021-02-02 15-45-01 的屏幕截图.png > > Please don't post code as images. > > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] How to improve the parallelism of go routine?

2021-02-02 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2021-02-01 at 23:48 -0800, 颜文泽 wrote: > This is my code: > 2021-02-02 15-45-01 的屏幕截图.png Please don't post code as images. -- 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

Re: [go-nuts] How to improve the parallelism of go routine?

2021-02-02 Thread 颜文泽
thank you。 在2021年2月2日星期二 UTC+8 下午4:17:46 写道: > On Tue, Feb 2, 2021 at 8:48 AM 颜文泽 wrote: > >> And then this is the result, it's amazing.I think I know why my program >> is slow, the number of routines is too high > > > 13 goroutines is certainly not "too high". > > >> but I found that the

Re: [go-nuts] How to improve the parallelism of go routine?

2021-02-02 Thread 'Axel Wagner' via golang-nuts
On Tue, Feb 2, 2021 at 8:48 AM 颜文泽 wrote: > And then this is the result, it's amazing.I think I know why my program is > slow, the number of routines is too high 13 goroutines is certainly not "too high". > but I found that the GOMAXPROCS function doesn't work, it's a really > confusing

Re: [go-nuts] How to improve the parallelism of go routine?

2021-02-02 Thread 颜文泽
Probably introduced by a third-party package. I'll troubleshoot. 在2021年2月2日星期二 UTC+8 下午3:50:32<颜文泽> 写道: > Note: I don't use the init function > 在2021年2月2日星期二 UTC+8 下午3:48:26<颜文泽> 写道: > >> If it works, it's fine, I'll just keep using vtune. I only work on x86 >> anyway. That said, I found