Hi Tamas,
You call "void match(const gchar *x, size_t len_x, const gchar *y, size_t
len_y)"
as "C.match(msg, C.size_t(len(y)), app, C.size_t(len(x)))" , where
app := C.CString(x)
defer C.free(unsafe.Pointer(app))
msg := C.CString(y)
defer C.free(unsafe.Pointer(msg))
?
Are the x, y, app,
Hello,
I was wondering why the stringer command has been implemented that way:
const _Pill_name = "PlaceboAspirinIbuprofen"
var _Pill_index = [...]uint8{0, 7, 14, 23}
func (i Pill) String() string {
if i < 0 || i >= Pill(len(_Pill_index)-1) {
return "Pill(" +
If you haven't gone through "A tour of Go", I'd suggest it - it is pretty
practical and helpful in learning the language:
https://tour.golang.org/welcome/1
"Go by Example" has a bunch of good resources too for practical use:
https://gobyexample.com/
Hope this helps!
Bob
On Mon, Feb 17, 2020,
It would exec.Command returns the result code of the process not whether it was
able to be executed.
> On Feb 17, 2020, at 7:51 PM, Dan Kortschak wrote:
>
> What do you see when you
>
> bash -c "lspci | grep -i vga | grep -i nvidia"
> echo $?
>
> If you have no nvidia line or no vga line
What do you see when you
bash -c "lspci | grep -i vga | grep -i nvidia"
echo $?
If you have no nvidia line or no vga line in lspci, this will output 1.
On Mon, 2020-02-17 at 14:41 -0800, Dean Schulze wrote:
> This command always sets the err to "exit status 1" even though it
> executes
This command always sets the err to "exit status 1" even though it executes
correctly:
out, err := exec.Command("/bin/bash", "-c", "lspci | grep -i vga | grep -i
nvidia").CombinedOutput()
I expected it to return 0 when executing successfully. What am I missing?
--
You received this message
> type Treenode struct {
> left *Treenode
> right *Treenode
> }
One could of course design a language where Treenode is called cons and
left is called car and right is called cdr and (car nil) is nil and (cdr
nil) is nil. You could implement such a language by putting 2 words of 0 at
2020. február 17., hétfő 16:33:42 UTC+1 időpontban Nitish Saboo a
következőt írta:
>
> Hi,
>
> These are my Go and C functions.I cannot explicitly garbage collect the C
> method before use, not sure if that is the issue.
> The first line in the 'match' method itself is not getting printed.
>
>
That's a very good point:
* A map can contain any type of value
* map[value_not_present] is defined to return the zero value
* If the map contains other maps:
(a) you don't want a new map to spring into life every time you access a
non-existent key - especially not a floating map which isn't
@Sam, hi, yes, that was the point ^^ My example was here to say "ok, so
let's say the first case works because we have made uninitialized maps
work, but how do we handle the second case?"
It was not made to be runnable as is, I just wanted it to be readable :)
Sorry if that was not clear
Le lun.
Hi Sam,
Thank You very much.
I will try this.
Could you please let me know which books should I follow to learn GO after
completing "Introducing GO"?
On Monday, January 27, 2020 at 9:46:12 PM UTC+5:30, Sam Whited wrote:
>
> On Mon, Jan 27, 2020, at 02:41, Kareem Shaikh wrote:
> > Can anyone
Hi Jake,
This works.
Thank You very much.
Could you please let me know which books should I follow to learn GO after
completing "Introducing GO"?
On Monday, January 27, 2020 at 10:26:31 PM UTC+5:30, Jake Montgomery wrote:
>
>
>
> On Monday, January 27, 2020 at 11:16:12 AM UTC-5, Sam Whited
Thank You Peter.
I will try this.
Could you please let me know which are the subsequent books to follow for
learning GO after "Introducing GO"?
On Tuesday, January 28, 2020 at 12:06:17 AM UTC+5:30, peterGo wrote:
>
> Kareem,
>
> Here is an example,
>
> package main
>
> import "fmt"
>
> func
I think you need to run your example; the behavior is the same: trying
to make an assignment to the non-nested map will panic contrary to what
your comment says.
> panic: assignment to entry in nil map
—Sam
On Mon, Feb 17, 2020, at 10:35, Michel Levieux wrote:
> Hi Kloster08,
>
> In addition to
I think you may be right, and I think I was barking up the wrong tree.
Sorry.
Regards
– Bhaskar
On Monday, February 17, 2020 at 11:20:07 AM UTC-5, Nitish Saboo wrote:
>
> Hi,
>
> How can runtime.Keepalive be helpful here ?
>
> Thanks,
> Nitish
>
> On Mon, Feb 17, 2020 at 9:14 PM K.S. Bhaskar >
I was curious about that too. Looking at the documentation, the
runtime.KeepAlive documentation could be improved:
A very simplified example showing where KeepAlive is required:
type File struct { d int }
d, err := syscall.Open("/file/path", syscall.O_RDONLY, 0)
// ... do something if err !=
Hi,
How can runtime.Keepalive be helpful here ?
Thanks,
Nitish
On Mon, Feb 17, 2020 at 9:14 PM K.S. Bhaskar wrote:
> See whether runtime.Keepalive (https://golang.org/pkg/runtime/#KeepAlive)
> helps.
>
> Regards
> – Bhaskar
>
> On Monday, February 17, 2020 at 10:33:42 AM UTC-5, Nitish Saboo
See whether runtime.Keepalive (https://golang.org/pkg/runtime/#KeepAlive)
helps.
Regards
– Bhaskar
On Monday, February 17, 2020 at 10:33:42 AM UTC-5, Nitish Saboo wrote:
>
> Hi,
>
> These are my Go and C functions.I cannot explicitly garbage collect the C
> method before use, not sure if that
Hi Kloster08,
In addition to what others have already pointed out, I'd like to bring you
another case that seems problematic to me concerning the construction of a
"usable nil value" for maps, in the sense that a zero-value map could be
written and read right away without any initialization.
Hi,
These are my Go and C functions.I cannot explicitly garbage collect the C
method before use, not sure if that is the issue.
The first line in the 'match' method itself is not getting printed.
void match(const gchar *x, size_t len_x, const gchar *y, size_t len_y)
{
printf("Reached match
Chances are that a parameter or structure you are passing from Go to C is
getting garbage collected by Go before the C code is done with it. Read the
CGO documentaton – it's dense, but every sentence, every word, has a
purpose.
In case it helps, take a look at the video of my recent talk at
Hi,
This is my go env:
nsaboo@ubuntu:~$ go version
go version go1.12.4 linux/amd64
nsaboo@ubuntu:~$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/nsaboo/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/nsaboo/Documents/goworkspace"
GOPROXY=""
On Mon, Feb 17, 2020 at 11:18 AM wrote:
> Out of curiosity: Could you please tell when calling methods on nil
> pointers is useful?
>
In general, linked datastructures - like linked lists or trees. As a
somewhat trivial example, consider this:
https://play.golang.org/p/Y-4aSVLzEFO
Interpreting
Got any conclusion for this?
On Monday, September 14, 2015 at 8:42:10 PM UTC+5:30,
bhuvane...@ptechnosoft.com wrote:
>
>
>
> Hi Everyone ,
>
> I m new to vmware and i started exploring different formats in
> vmdk ,snapshots and all.I m using golang as a programming language.I
A "usable" nil map, i.e. being able to insert into it straight away, I
sympathise with. Remember though that you can't append "in place" to a nil
slice: it returns a new slice object. https://play.golang.org/p/dL-r74C5m_w
I presume you don't want to write the same for maps as you do for
Am Montag, 17. Februar 2020 10:22:23 UTC+1 schrieb Jan Mercl:
>
> On Sun, Feb 16, 2020 at 9:38 AM Johann Höchtl > wrote:
> >
> > Anybody? My question was not meant to criticize vim-go or gopls, if they
> can't (yet) do what I want those tools to support me, but a honest
> questions if I do
Hi,
On Sat, Feb 15, 2020 at 6:13 PM Amarjeet Anand
wrote:
> I need it quite often, maybe because of the kind of project am working on
> currently.
>
I'd be super curious what that is. TBH, given how frequently this has come
up, I've been wrecking my brain trying to figure out what people need
Nil slices are an example of an ideal zero value. When you use them, you
don't need to check for nil -> its zero value is already usable.
Exactly the "slices" case (and the "string" type) is the one inspiring me
to search for more useful zero values for certain types. The two I am
thinking
I thought of this at the beginning, but when I tried to make it work I
realized that I needed to have the following if:
if s != nil {
/* initialize struct or inform it is nil */
}
on every struct method, which eventually defeated the purpose for my use
case.
Out of curiosity: Could you
I am not obsessed with try catch, I do not even like it. And I
definitely do not want to copy it or have it in Go. As I said in the post,
I like to *read* else catch with an implicit try before the function call
and therefore named it else catch. And I think the else catch is not like
try
I do not think ternary belongs in Go. As Kevin and disroot noted below, I
also prefer cleaner syntax even if it is more verbose. Its usage would also
overlap with with the if statement, so which would you use when? I really
appreciate the opinionated go fmt (and gofumpt) so we have do not to
Brian, you pointed out some important issues I was concerned about. Go does
not and should not have any magic, so that is definitely a big problem. I
also agree with you, that limiting the available expression syntax is not
great and that else catch could make code non-obvious.
Regarding doing
On Sun, Feb 16, 2020 at 9:38 AM Johann Höchtl wrote:
>
> Anybody? My question was not meant to criticize vim-go or gopls, if they
> can't (yet) do what I want those tools to support me, but a honest questions
> if I do not know how to use the tools.
I no more use vim-go, I've switched from
33 matches
Mail list logo