[go-nuts] Docker container vscode debugging issue

2023-06-10 Thread Michael Odumosu
Greetings I am trying to debug an open source pacakge hashicorp vault from 
a docker container, I am using vscode remote debugging however its not 
stopping on any of the breakpoints. I tried changing the remote path 
according to this article but no luck, the reason I am debugging hashicorp 
vault is to override the invalid token when you try to set the 
DEV_TOKEN_ROOT_ID to a value that the vault itself would most likely 
create. I need this to happen for a hackathon submission, and the review 
will fail if I cant get this corrected in time. Please assist

-- 
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 web visit 
https://groups.google.com/d/msgid/golang-nuts/3561e79e-7e4e-4a3e-8b08-cb7cfb9f0220n%40googlegroups.com.


Re: [go-nuts] Re: Amateur's questions about "Go lang spec"

2023-06-10 Thread Kamil Ziemian
Thank you for encouraging words about generic in spec. Knowing that much 
more skilled people than I also have problem with understanding this part 
of spec, give my self assessment a boost.

sobota, 10 czerwca 2023 o 21:44:22 UTC+2 Axel Wagner napisał(a):

> If it helps, I don't think I really understand the generics parts of the 
> spec myself.
>
> On Sat, Jun 10, 2023 at 7:13 PM Kamil Ziemian  wrote:
>
>> This is not a complaint, but a reflection. I have read, as careful as I 
>> can, the half of the Go Spec and if I didn't learn how parametric 
>> polymorphism (generics; did I spell it right) should work from proposals 
>> and talks on YouTube, I would probably understand 30% less from it. I know 
>> that how parametric polymorphis works in Go and how is described in Spec is 
>> not in 100% identical with proposals, but it is good enough. Due to them I 
>> have overall picture of what type parameters and related concepts are, so I 
>> can guess what is the intention behind part of the Spec that mention type 
>> them.
>>
>> I think I just wouldn't be able learn parametric polymorphism from 
>> reading Spec. Things related to it are scattered across the text (this is 
>> not a complaint, I just notice a fact) and gathering them together is not a 
>> easy task.
>>
>> I should note, that I want to use parametric polymorphism as really as 
>> possible. For me this is a feature of the last resort, but one that you 
>> should know that exists.
>>
>> Needless to say, I will need to read Spec one more time in the future, at 
>> least.
>>
>> Best regards,
>> Kamil
>>
>> sobota, 3 czerwca 2023 o 23:48:52 UTC+2 Sean Liao napisał(a):
>>
>>> It is not a typo
>>>
>>> https://go.dev/issue/24451
>>>
>>> - sean
>>>
>>>
>>> On Sat, Jun 3, 2023 at 10:05 PM peterGo  wrote:
>>>
 It's a simple typo. Send in a fix.

 peter

 On Saturday, June 3, 2023 at 4:07:15 PM UTC-4 Kamil Ziemian wrote:

> As burak serdar said, 9 = 3 * 3 is not a prime number, all other 
> elements in the slice are prime numbers. It looks like authors of Go Spec 
> want to make a joke or check how well people read examples in it.
>
> Best regards,
> Kamil
> sobota, 3 czerwca 2023 o 21:52:37 UTC+2 burak serdar napisał(a):
>
>> On Sat, Jun 3, 2023 at 1:40 PM peterGo  wrote:
>>
>>>
>>> Kamil Ziemian,
>>>
>>> // list of prime numbers 
>>> primes := []int{2, 3, 5, 7, 9, 2147483647 <(214)%20748-3647>}
>>>
>>> The variable prime is a list of some prime numbers starting with the 
>>> lowest and ending with the highest prime numbers that can safely be 
>>> represented an int. An int may either 32 or 64 bits.
>>>
>>> Please explain the joke.
>>>
>>
>> Could it be that 9 is not prime?
>>  
>>
>>>
>>>
>>> Note: “Explaining a joke is like dissecting a frog. You understand 
>>> it better but the frog dies in the process.”
>>> ― E.B. White
>>>
>>> peter
>>> On Saturday, June 3, 2023 at 3:13:28 PM UTC-4 Kamil Ziemian wrote:
>>>
 Is this example found in the "Composite literals" section of Go 
 Spec a joke?
 // list of prime numbers 
 primes := []int{2, 3, 5, 7, 9, 2147483647 <(214)%20748-3647>}

 I checked on the internet and 2147483647 <(214)%20748-3647> is a 
 prime number (https://en.wikipedia.org/wiki/2,147,483,647), so 
 this element is fine.

 Best regards
 Kamil

 czwartek, 4 maja 2023 o 16:38:50 UTC+2 Kamil Ziemian napisał(a):

> You convince me to your point Axel Wagner. At the same time if we 
> look at examples in Go Spec, I think their can be improved.
> "A0, A1, and []string 
> A2 and struct{ a, b int } 
> A3 and int A4, func(int, float64) *[]string, and A5 
>
> B0 and C0 
> D0[int, string] and E0 
> []int and []int 
> struct{ a, b *B5 } and struct{ a, b *B5 } 
> func(x int, y float64) *[]string, func(int, float64) (result 
> *[]string), and A5"
> I mean, first we need to check that A0, A1 and []string are the 
> same type and after few examples like D0[int, string] is the same as 
> E0, we 
> have stated []int and []int are the same type. If you convince 
> yourself 
> that A0 is the same as A1 and both are the same as []string, checking 
> that 
> []int has the same type as []int is quite trivial. I would prefer 
> that 
> examples would start from basic cases like []int is []int and []A3 is 
> []int 
> (if this one is true) and progress to more convoluted like D0[int, 
> string] 
> is E0.
>
> Best regards,
> Kamil
>
> czwartek, 4 maja 2023 o 14:12:25 UTC+2 Axel Wagner napisał(a):
>
>> Personally, I'd rather add more examples 

Re: [go-nuts] Re: Amateur's questions about "Go lang spec"

2023-06-10 Thread 'Axel Wagner' via golang-nuts
If it helps, I don't think I really understand the generics parts of the
spec myself.

On Sat, Jun 10, 2023 at 7:13 PM Kamil Ziemian  wrote:

> This is not a complaint, but a reflection. I have read, as careful as I
> can, the half of the Go Spec and if I didn't learn how parametric
> polymorphism (generics; did I spell it right) should work from proposals
> and talks on YouTube, I would probably understand 30% less from it. I know
> that how parametric polymorphis works in Go and how is described in Spec is
> not in 100% identical with proposals, but it is good enough. Due to them I
> have overall picture of what type parameters and related concepts are, so I
> can guess what is the intention behind part of the Spec that mention type
> them.
>
> I think I just wouldn't be able learn parametric polymorphism from reading
> Spec. Things related to it are scattered across the text (this is not a
> complaint, I just notice a fact) and gathering them together is not a easy
> task.
>
> I should note, that I want to use parametric polymorphism as really as
> possible. For me this is a feature of the last resort, but one that you
> should know that exists.
>
> Needless to say, I will need to read Spec one more time in the future, at
> least.
>
> Best regards,
> Kamil
>
> sobota, 3 czerwca 2023 o 23:48:52 UTC+2 Sean Liao napisał(a):
>
>> It is not a typo
>>
>> https://go.dev/issue/24451
>>
>> - sean
>>
>>
>> On Sat, Jun 3, 2023 at 10:05 PM peterGo  wrote:
>>
>>> It's a simple typo. Send in a fix.
>>>
>>> peter
>>>
>>> On Saturday, June 3, 2023 at 4:07:15 PM UTC-4 Kamil Ziemian wrote:
>>>
 As burak serdar said, 9 = 3 * 3 is not a prime number, all other
 elements in the slice are prime numbers. It looks like authors of Go Spec
 want to make a joke or check how well people read examples in it.

 Best regards,
 Kamil
 sobota, 3 czerwca 2023 o 21:52:37 UTC+2 burak serdar napisał(a):

> On Sat, Jun 3, 2023 at 1:40 PM peterGo  wrote:
>
>>
>> Kamil Ziemian,
>>
>> // list of prime numbers
>> primes := []int{2, 3, 5, 7, 9, 2147483647 <(214)%20748-3647>}
>>
>> The variable prime is a list of some prime numbers starting with the
>> lowest and ending with the highest prime numbers that can safely be
>> represented an int. An int may either 32 or 64 bits.
>>
>> Please explain the joke.
>>
>
> Could it be that 9 is not prime?
>
>
>>
>>
>> Note: “Explaining a joke is like dissecting a frog. You understand it
>> better but the frog dies in the process.”
>> ― E.B. White
>>
>> peter
>> On Saturday, June 3, 2023 at 3:13:28 PM UTC-4 Kamil Ziemian wrote:
>>
>>> Is this example found in the "Composite literals" section of Go
>>> Spec a joke?
>>> // list of prime numbers
>>> primes := []int{2, 3, 5, 7, 9, 2147483647 <(214)%20748-3647>}
>>>
>>> I checked on the internet and 2147483647 <(214)%20748-3647> is a
>>> prime number (https://en.wikipedia.org/wiki/2,147,483,647), so this
>>> element is fine.
>>>
>>> Best regards
>>> Kamil
>>>
>>> czwartek, 4 maja 2023 o 16:38:50 UTC+2 Kamil Ziemian napisał(a):
>>>
 You convince me to your point Axel Wagner. At the same time if we
 look at examples in Go Spec, I think their can be improved.
 "A0, A1, and []string
 A2 and struct{ a, b int }
 A3 and int A4, func(int, float64) *[]string, and A5

 B0 and C0
 D0[int, string] and E0
 []int and []int
 struct{ a, b *B5 } and struct{ a, b *B5 }
 func(x int, y float64) *[]string, func(int, float64) (result
 *[]string), and A5"
 I mean, first we need to check that A0, A1 and []string are the
 same type and after few examples like D0[int, string] is the same as 
 E0, we
 have stated []int and []int are the same type. If you convince yourself
 that A0 is the same as A1 and both are the same as []string, checking 
 that
 []int has the same type as []int is quite trivial. I would prefer that
 examples would start from basic cases like []int is []int and []A3 is 
 []int
 (if this one is true) and progress to more convoluted like D0[int, 
 string]
 is E0.

 Best regards,
 Kamil

 czwartek, 4 maja 2023 o 14:12:25 UTC+2 Axel Wagner napisał(a):

> Personally, I'd rather add more examples of "self-evidently equal
> types". In my opinion, all the type aliases in that block confuse 
> matters
> quite a bit.
>
> "[]int and []int are identical" is not actually self-evident at
> all. It is self-evident that any sensible definition of type identity
> *should* make them identical. But it's not self-evident that the given
> definition *does*. Spelling that out in the example, 

Re: [go-nuts] Re: Amateur's questions about "Go lang spec"

2023-06-10 Thread Kamil Ziemian
This is not a complaint, but a reflection. I have read, as careful as I 
can, the half of the Go Spec and if I didn't learn how parametric 
polymorphism (generics; did I spell it right) should work from proposals 
and talks on YouTube, I would probably understand 30% less from it. I know 
that how parametric polymorphis works in Go and how is described in Spec is 
not in 100% identical with proposals, but it is good enough. Due to them I 
have overall picture of what type parameters and related concepts are, so I 
can guess what is the intention behind part of the Spec that mention type 
them.

I think I just wouldn't be able learn parametric polymorphism from reading 
Spec. Things related to it are scattered across the text (this is not a 
complaint, I just notice a fact) and gathering them together is not a easy 
task.

I should note, that I want to use parametric polymorphism as really as 
possible. For me this is a feature of the last resort, but one that you 
should know that exists.

Needless to say, I will need to read Spec one more time in the future, at 
least.

Best regards,
Kamil

sobota, 3 czerwca 2023 o 23:48:52 UTC+2 Sean Liao napisał(a):

> It is not a typo
>
> https://go.dev/issue/24451
>
> - sean
>
>
> On Sat, Jun 3, 2023 at 10:05 PM peterGo  wrote:
>
>> It's a simple typo. Send in a fix.
>>
>> peter
>>
>> On Saturday, June 3, 2023 at 4:07:15 PM UTC-4 Kamil Ziemian wrote:
>>
>>> As burak serdar said, 9 = 3 * 3 is not a prime number, all other 
>>> elements in the slice are prime numbers. It looks like authors of Go Spec 
>>> want to make a joke or check how well people read examples in it.
>>>
>>> Best regards,
>>> Kamil
>>> sobota, 3 czerwca 2023 o 21:52:37 UTC+2 burak serdar napisał(a):
>>>
 On Sat, Jun 3, 2023 at 1:40 PM peterGo  wrote:

>
> Kamil Ziemian,
>
> // list of prime numbers 
> primes := []int{2, 3, 5, 7, 9, 2147483647 <(214)%20748-3647>}
>
> The variable prime is a list of some prime numbers starting with the 
> lowest and ending with the highest prime numbers that can safely be 
> represented an int. An int may either 32 or 64 bits.
>
> Please explain the joke.
>

 Could it be that 9 is not prime?
  

>
>
> Note: “Explaining a joke is like dissecting a frog. You understand it 
> better but the frog dies in the process.”
> ― E.B. White
>
> peter
> On Saturday, June 3, 2023 at 3:13:28 PM UTC-4 Kamil Ziemian wrote:
>
>> Is this example found in the "Composite literals" section of Go Spec 
>> a joke?
>> // list of prime numbers 
>> primes := []int{2, 3, 5, 7, 9, 2147483647 <(214)%20748-3647>}
>>
>> I checked on the internet and 2147483647 <(214)%20748-3647> is a 
>> prime number (https://en.wikipedia.org/wiki/2,147,483,647), so this 
>> element is fine.
>>
>> Best regards
>> Kamil
>>
>> czwartek, 4 maja 2023 o 16:38:50 UTC+2 Kamil Ziemian napisał(a):
>>
>>> You convince me to your point Axel Wagner. At the same time if we 
>>> look at examples in Go Spec, I think their can be improved.
>>> "A0, A1, and []string 
>>> A2 and struct{ a, b int } 
>>> A3 and int A4, func(int, float64) *[]string, and A5 
>>>
>>> B0 and C0 
>>> D0[int, string] and E0 
>>> []int and []int 
>>> struct{ a, b *B5 } and struct{ a, b *B5 } 
>>> func(x int, y float64) *[]string, func(int, float64) (result 
>>> *[]string), and A5"
>>> I mean, first we need to check that A0, A1 and []string are the same 
>>> type and after few examples like D0[int, string] is the same as E0, we 
>>> have 
>>> stated []int and []int are the same type. If you convince yourself that 
>>> A0 
>>> is the same as A1 and both are the same as []string, checking that 
>>> []int 
>>> has the same type as []int is quite trivial. I would prefer that 
>>> examples 
>>> would start from basic cases like []int is []int and []A3 is []int (if 
>>> this 
>>> one is true) and progress to more convoluted like D0[int, string] is E0.
>>>
>>> Best regards,
>>> Kamil
>>>
>>> czwartek, 4 maja 2023 o 14:12:25 UTC+2 Axel Wagner napisał(a):
>>>
 Personally, I'd rather add more examples of "self-evidently equal 
 types". In my opinion, all the type aliases in that block confuse 
 matters 
 quite a bit.

 "[]int and []int are identical" is not actually self-evident at 
 all. It is self-evident that any sensible definition of type identity 
 *should* make them identical. But it's not self-evident that the given 
 definition *does*. Spelling that out in the example, means you are 
 nudged 
 to look at the definition and see how their identity follows (by 
 finding 
 "Two slice types are identical if they have identical element types").

 In fact, whenever you 

Re: [go-nuts] is running interactive or not

2023-06-10 Thread Robert Engels
No need to even think about this. Look at ssh and mimic their practices. It has 
been thoroughly audited. 

> On Jun 10, 2023, at 5:35 AM, quin...@gmail.com  wrote:
> 
> there has been much discussion in the past about programs that modify their 
> behaviour depending on what stdout is; 
> http://harmful.cat-v.org/cat-v/unix_prog_design.pdf
> 
> i do to want to start a war, just suggest a different approach is available.
> 
> my suggestion would be to always expect a password from standard input and to 
> do document this, suggesting, for non-interactive use people could do 
> something like:
> 
>  echo password | application
> 
> using environment variables or passing passwords on the command line are 
> rather leaky.
> 
> -Steve
> 
> 
> 
>> On Friday, 9 June 2023 at 00:52:58 UTC+1 Rich wrote:
>> Thank you Cris and Kurtis -- For this project I am going with the switch 
>> option -- but I have other programs that I am going to replace the os.Getpid 
>> and os.Getppid trick with go-isatty.
>> 
>> 
>> 
>>> On Thursday, June 8, 2023 at 3:22:29 PM UTC-4 Chris Burkert wrote:
>>> Hi, there are cases when this does not work. I tend to use a flag like 
>>> -batch or -noninteractive to trigger the correct behavior from within 
>>> scripts. Less magic, more control.
>>> 
>>> Rich  schrieb am Do. 8. Juni 2023 um 20:19:
 Hi, 
 
 I have a program I am writing that stops and asks the user for input, in 
 this case it's a passphrase used to encrypt output.
 
  I want the program to also be able to be used in a script, and if in a 
 script use a predefined value as the passphrase. What I'd like to know is 
 how to detect if running in a script or not.  I've tried something like 
 this:
 runPid := os.Getpid()
 parPid := os.Getppid()
 val := runPid - parPid //normally I check if runPid is > parPid in my code.
 if val < 20 {
   fmt.Println("Not running in a script")
 }
 This works, but only if the script ran quickly. Wondering if there is a 
 better way to do this?
 
>>> 
 -- 
 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...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/golang-nuts/c8ae1be5-5a6b-45af-9249-ccdb02283d97n%40googlegroups.com.
> 
> -- 
> 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 web visit 
> https://groups.google.com/d/msgid/golang-nuts/b5285e0c-51bf-4ec5-8682-70b5a324c32bn%40googlegroups.com.

-- 
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 web visit 
https://groups.google.com/d/msgid/golang-nuts/1623BF2C-4FB9-458A-813B-5FD80A89D443%40ix.netcom.com.


Re: [go-nuts] is running interactive or not

2023-06-10 Thread quin...@gmail.com
there has been much discussion in the past about programs that modify their 
behaviour depending on what stdout is; 
http://harmful.cat-v.org/cat-v/unix_prog_design.pdf

i do to want to start a war, just suggest a different approach is available.

my suggestion would be to always expect a password from standard input and 
to do document this, suggesting, for non-interactive use people could do 
something like:

 echo password | application

using environment variables or passing passwords on the command line are 
rather leaky.

-Steve



On Friday, 9 June 2023 at 00:52:58 UTC+1 Rich wrote:

> Thank you Cris and Kurtis -- For this project I am going with the switch 
> option -- but I have other programs that I am going to replace the 
> os.Getpid and os.Getppid trick with go-isatty.
>
>
>
> On Thursday, June 8, 2023 at 3:22:29 PM UTC-4 Chris Burkert wrote:
>
>> Hi, there are cases when this does not work. I tend to use a flag like 
>> -batch or -noninteractive to trigger the correct behavior from within 
>> scripts. Less magic, more control.
>>
>> Rich  schrieb am Do. 8. Juni 2023 um 20:19:
>>
>>> Hi, 
>>>
>>> I have a program I am writing that stops and asks the user for input, in 
>>> this case it's a passphrase used to encrypt output.
>>>
>>>  I want the program to also be able to be used in a script, and if in a 
>>> script use a predefined value as the passphrase. What I'd like to know is 
>>> how to detect if running in a script or not.  I've tried something like 
>>> this:
>>> runPid := os.Getpid()
>>> parPid := os.Getppid()
>>> val := runPid - parPid //normally I check if runPid is > parPid in my 
>>> code.
>>> if val < 20 {
>>> fmt.Println("Not running in a script")
>>> }
>>> This works, but only if the script ran quickly. Wondering if there is a 
>>> better way to do this?
>>>
>>> -- 
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/golang-nuts/c8ae1be5-5a6b-45af-9249-ccdb02283d97n%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>

-- 
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 web visit 
https://groups.google.com/d/msgid/golang-nuts/b5285e0c-51bf-4ec5-8682-70b5a324c32bn%40googlegroups.com.


[go-nuts] smarter way to provide interface capabilities from underlining interface

2023-06-10 Thread Vasiliy Tolstov
I have sql driver that wraps original driver.Driver, to be able to work
with drivers that not have ExecerContext or QuerierContext i need to return
wrapped to that supports only needed interfaces.
I'm to want to write all cases via handmade switch case and write generator
that creates full combo list of methods and generate interfaces for this
methods.
But this brings file that contains 20K lines
https://git.unistack.org/unistack-org/micro-wrapper-sql/src/branch/master/wrap_gen.go
Does it possible to have smaller code that provides the same effect?
Or I'm miss something?

-- 
Vasiliy Tolstov,
e-mail: v.tols...@selfip.ru

-- 
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 web visit 
https://groups.google.com/d/msgid/golang-nuts/CACaajQuX2Srh%3D7yWeFQxK_DfhHtWARUp4v7o-rbvagMFwwAy6w%40mail.gmail.com.