When I run a go program from the shell, os.Args[0] is the program name. If
I invoke the same program using go's exec then os.Args[0] is not the
program name, rather its the first argument that I pass.
Here is a simple program to show this behavior, installed as gocmd in my
$GOPATH/bin
func mai
On Thursday, June 1, 2017 at 10:45:56 AM UTC-7, Jan Mercl wrote:
>
> On Thu, Jun 1, 2017 at 7:41 PM Santhosh Ram Manohar > wrote:
>
> > Args: []string{"self", "selftest"},
>
> Here you explicitly pass arsg[0] == "self" and that's w
>From https://blog.golang.org/gobs-of-data
"The first time you encode a value of a given type, the gob package builds
a little interpreted machine specific to that data type. It uses reflection
on the type to construct that machine, but once the machine is built it
does not depend on reflection
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
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
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
On Sun, Jul 9, 2017 at 12:30 AM, Dave Cheney wrote:
> As your using the unsafe package your doing things which are not
> considered safe by the lanaguge so only imprecise interpretations are
> possible. My interpretation is, assuming that next words after p in memory
> are zeroed the you have eff