Tong Sun writes:
> I have a function (func MyFunc) whose def ends with
>
> , fileNames ...string)
>
> How can I passed the flag.Args() (of type []string) to this function?
>
> Thx
args := flag.Args()
MyFunc(args...)
see https://golang.org/ref/spec#Passing_arguments_to_..._parameters
--
You
I have a function (func MyFunc) whose def ends with
, fileNames ...string)
How can I passed the flag.Args() (of type []string) to this function?
Thx
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop rece
On Sat, Jul 8, 2017 at 4:41 PM, Rob Pike wrote:
> From https://talks.golang.org/2012/splash.article:
>
> …
Thanks; I feel much more comfortable with that design having some
literature (as well as the voices of several community members in this
thread) to back it up. I'm suprised this isn't an iss
On Sat, Jul 8, 2017 at 7:37 PM, Ian Lance Taylor wrote:
> On Sat, Jul 8, 2017 at 6:59 PM, Santhosh Ram Manohar
> wrote:
> >
> > On Saturday, July 8, 2017 at 4:09:32 PM UTC-7, Dave Cheney wrote:
> >>
> >> An array is a vector of values in memory. A slice is a small struct that
> >> describes an a
On Sat, Jul 8, 2017 at 6:59 PM, Santhosh Ram Manohar
wrote:
>
> On Saturday, July 8, 2017 at 4:09:32 PM UTC-7, Dave Cheney wrote:
>>
>> An array is a vector of values in memory. A slice is a small struct that
>> describes an array stored elsewhere in memory.
>
>
> I understand the slice vs array d
https://blog.golang.org/constants
This explains why you can do stuff like that and why the Go team decided to
make the language work this way.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emai
Hello golang-nuts,
Here are two code snippets with operations on different types. One with
constants and another one with variables. The first one works, the second
one doesn't. Why is it like this? Logically both code snippets shouldn't
work:
https://play.golang.org/p/eqNJootZ3a
package main
Hi Michael,
Can you please explain more in details how you solve this issue? I am also
experience same problem while trying to compile go code in a 32-bit Solaris
10.(I install the gccgo by using opencsw -> gcc5core) I can successfully
compile the code using:
/opt/csw/bin/i386-pc-solaris2.10-g
Dave,
On Saturday, July 8, 2017 at 4:09:32 PM UTC-7, Dave Cheney wrote:
> An array is a vector of values in memory. A slice is a small struct that
> describes an array stored elsewhere in memory.
I understand the slice vs array difference. But in this statement,
intPtr := (*[]byte)(p)
my int
An array is a vector of values in memory. A slice is a small struct that
describes an array stored elsewhere in memory.
https://blog.golang.org/go-slices-usage-and-internals
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from th
hello,
This piece of code prints [10 0 0 0] as expected..
func main() {
i := 10
p := unsafe.Pointer(&i)
intPtr := (*[4]byte)(p)
fmt.Println(*intPtr)
}
But if I convert the unsafe.Pointer to pointer to a byte slice rather than
an array of 4 bytes it prints an empt
Fair enough. Thanks for the explanation. It also seems to imply that the
idiomatic way is to have multiple functions as opposed to abusing variadic
args, which answers the OP's question.
On Saturday, July 8, 2017 at 2:42:30 PM UTC-7, Rob 'Commander' Pike wrote:
>
> From https://talks.golang.org
>From https://talks.golang.org/2012/splash.article:
*One feature missing from Go is that it does not support default function
arguments. This was a deliberate simplification. Experience tells us that
defaulted arguments make it too easy to patch over API design flaws by
adding more arguments, resu
On Fri, Jul 7, 2017 at 1:10 AM, wrote:
>
> So, is it strange that gccgo can't compile if the main.go imports some
> non-standard library package?
> Is it meaning with gccgo, we have to write a single go file to contain
> everything, or just import only the standard library package?
> I used to tr
This is where having defaults for function arguments would make for a nicer
API, like python and other langs. Go 2. Maybe.
I agree that the variadic version is not great for a public API, though I
do abuse it in test helpers because it's convenient.
On Friday, July 7, 2017 at 10:42:25 PM UTC-7,
I noticed your “naive explanation” after I sent my message. But I think it is
the real explanation.
Is there a better way to do it in Go? Probably not. The math/big library isn’t
quite as fast as gmp, but it’s probably faster than anything you’d write
yourself. If the numbers were really huge,
Sam Whited writes:
> More opinions on the best way to do this would still be welcome, of
> course. Thanks!
I've personally found that when designing an API, it's generally better
to consider two things that are almost but not quite the same as two
things (or, two endpoints if you prefer).
To me
Hi,
On Friday, July 7, 2017 at 6:48:01 PM UTC+2, Andy Balholm wrote:
>
> That’s normal for languages like Python. The code that is actually running
> in Python is slow, but library functions are fast, because they are written
> in C.
>
Sure ... that's why I wrote the 'naive explanation' that sa
Shawn,
I'm a little confused.
Your program prints 'Certificate for "revoked.badssl.com" from "DigiCert
Inc" expires 2019-09-11 12:00:00 + UTC (795 days).' for the revoked
certificate.
How do I tell that it has been revoked?
Gary.
Cr@p. I just realized that I titled the post "expired" wh
19 matches
Mail list logo