Yes I did, what do you mean by top part of the screen?
On Wednesday, May 23, 2018 at 6:54:47 AM UTC-7, buc...@gmail.com wrote:
>
> No. It is an IDE. You write your code in the top part of the screen.
> In the bottom part (the Powershell), you then invoke the compiler with "go
> build yourfi
The syntax you are looking for is:
max(test.vals...)
The ellipsis indicates that the var args are the *contents* of the slice,
as opposed to trying to pass the slice as if it were just a single element
of the var args.
*Josh Humphries*
jh...@bluegosling.com
On Wed, May 23, 2018 at 7:09
I got it!
max(test.vals...)
On Wednesday, May 23, 2018 at 4:09:01 PM UTC-7, Alex Dvoretskiy wrote:
>
> How do you write test for variadic functions?
>
> For example I have function:
>
> func max(vals ...int) int {
> m := 0
> for _, v := range vals {
> if v > m {
> m = v
> }
> return m
> }
>
>
> a
The struct field should be vals []int and then you'd call
max(test.vals...).
On Wed, May 23, 2018 at 4:09 PM Alex Dvoretskiy
wrote:
> How do you write test for variadic functions?
>
> For example I have function:
>
> func max(vals ...int) int {
> m := 0
> for _, v := range vals {
> if v > m {
>
How do you write test for variadic functions?
For example I have function:
func max(vals ...int) int {
m := 0
for _, v := range vals {
if v > m {
m = v
}
return m
}
and how to write a few tests for it? I can't put vals ...int
in struct
package main
import (
"testing"
)
func TestMax(t *testi
The go command prompt program (“go help”) will run the compiler, a separate
program, when certain commands are used (like “go build”). The compile
process creates a file that is the program you wrote if no errors are
found, and you can then run this program file to do the work you coded.
An IDE
On Wed, 23 May 2018 03:03:18 -0700 (PDT)
lafolle wrote:
> Thanks Mathias for clearing this out.
>
> I reasoned this out by looking at the address to which `i` was
> allocated to, though I wanted to _peek_ inside the slice's header to
> be affirmative. But I can't clearly understand how to use u
This is really useful for me. Thanks a lot!
On Tuesday, 22 May 2018 23:59:26 UTC+2, matthe...@gmail.com wrote:
>
> Hello, here’s a code review. Thanks for sharing here.
>
> These are my unfiltered opinions that may be wrong, and I hope they are
> useful for you.
>
> Have you considered including
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ctriple/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ctriple/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS
I would suggest you join a chat server so people can guide you through the
whole process with a quicker response time than the hours you are waiting
for each reply on a forum such as this one.
https://discordapp.com/invite/PxwHvBS
https://invite.slack.golangbridge.org/
#go-nuts on irc.freenode.n
FYI, this was answered my Russ on Twitter, for a while the format
was not in the spec, but it has returned now.
--
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
No. It is an IDE. You write your code in the top part of the screen. In
the bottom part (the Powershell), you then invoke the compiler with "go
build yourfilename.go".
Did you get Go installed?
On Tuesday, May 22, 2018 at 10:41:07 PM UTC-6, John wrote:
>
> Is the visual code studio an compi
On Wed, May 23, 2018 at 2:49 PM Sreekanth G
wrote:
Hi,
I have install GoLang on Suse Linux on IBM cloud.
go version is go1.10.2 linux/s390x
> go path is
> export PATH=$PATH:/usr/local/go/bin
Note: That's PATH, not GOPATH.
> export GOROOT=$HOME/go1.X
>
> export PATH=$PATH:$GOROOT/bin
Note: No
this may help you:
https://gist.github.com/nikhita/432436d570b89cab172dcf2894465753
--
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...@google
Hi,
I have install *GoLang* on Suse Linux on IBM cloud.
go version is* go1.10.2 linux/s390x*
go path is
export PATH=$PATH:/usr/local/go/bin
export GOROOT=$HOME/go1.X
export PATH=$PATH:$GOROOT/bin
When running the *go build* command it’s showing error. see below ,
*linux1@sfhyperledger:~/go
You don't need maps for this: https://play.golang.org/p/ylIdX7P9Syy
Sorting is your friend.
--
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.
I'm slow... I should have picked it up, I did vaguely follow the discussion
over type aliases.
Oh, well, just shows.
Lucio.
On Wednesday, 23 May 2018 12:20:34 UTC+2, Jan Mercl wrote:
>
>
>
>
> On Wed, May 23, 2018 at 12:15 PM Lucio >
> wrote:
>
> > I can't believe I've overlooked this "feature
I am using *golang.org/x/net/http2* and *golang.org/x/net/http2/**hpack*
packages to do low level http2 framing. For requests with only HEADERS
frame sent, I want to send a empy json '{}', so I send 1 HEADERS frame and
1 DATA frame as below
headersframe, ok := frame.(*http2.Hea
On Wed, May 23, 2018 at 12:15 PM Lucio wrote:
> I can't believe I've overlooked this "feature" in the documentation.
Introduced in Go 1.9: https://golang.org/doc/go1.9#language
--
-j
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubs
I can't believe I've overlooked this "feature" in the documentation. I came
across this by accident, no doubt I changed my mind without completing the
operation and forgot the equals sign.
package main
import (
"fmt"
)
type label = struct{ i int }
func main() {
v := label{i: 10}
fmt.Println(v
On Wed, 23 May 2018 00:25:49 -0700 Karan Chaudhary wrote:
>
> One other simpler (and not so elegant) solution is to use separate set for
> each element.
>
> https://play.golang.org/p/9ZSRfAyOX4-
>
> @Bakul's solution sounds good but haven't tried to understand it clearly.
See https://play.gol
Thanks Mathias for clearing this out.
I reasoned this out by looking at the address to which `i` was allocated to,
though I wanted to _peek_ inside the slice's header to be affirmative. But
I can't clearly understand how to use unsafe pointer. Thanks for showing
how to use it.
One thing I don'
On Wed, 23 May 2018 13:29:17 +0530
Sankar P wrote:
> I extracted the confusing part alone, when appending to an array, the
> items are different than the resultant array into a separate go
> program.
>
> The Playground URL is: https://play.golang.org/p/BJM0H_rYNdb
>
> If someone can explain the
The slice which is created to be appended to b, points to &i, which (i)
gets updated in next (last) loop iteration.
Hence in last iteration, first element in `b` will start pointing to the
new array [4,5,6].
This could have been mitigated had `i` been allocated to new location on
every it
Thanks.
2018-05-23 13:55 GMT+05:30 :
> You keep the reference of the loop index that points at the last array.
> Either make a copy of it or use a slice of arrays.
>
> https://play.golang.org/p/WcOHQ_wIKjx
> https://play.golang.org/p/CToFC9w88M7
>
>
> Le mercredi 23 mai 2018 09:59:53 UTC+2, Sanka
You keep the reference of the loop index that points at the last array.
Either make a copy of it or use a slice of arrays.
https://play.golang.org/p/WcOHQ_wIKjx
https://play.golang.org/p/CToFC9w88M7
Le mercredi 23 mai 2018 09:59:53 UTC+2, Sankar a écrit :
>
> I extracted the confusing part alone
I extracted the confusing part alone, when appending to an array, the items
are different than the resultant array into a separate go program.
The Playground URL is: https://play.golang.org/p/BJM0H_rYNdb
If someone can explain the output I would be thankful. It feels like a bug
to me, but I am su
On Wed, May 23, 2018 at 1:29 AM wrote:
> Is there an inbuilt library function that does this?
There's not. However note that the log package adds the final \n
automatically to every output not already having it.
--
-j
--
You received this message because you are subscribed to the Google Gro
https://play.golang.org/p/dqp7po8Tg_4 is a working solution and it takes
only O(n^2), if you are curios. Your way of creating a numMem is also nice.
Thanks.
2018-05-23 12:55 GMT+05:30 Karan Chaudhary :
> One other simpler (and not so elegant) solution is to use separate set for
> each element.
>
Hi guys,
I'm after a way to visualize all types in my project spanning multiple
packages. This includes both which types are composed of which other types
and which functions are attached to the different types. Something similar
to UML class diagrams.
Is there such a tool already or do i have
I don't know if its a good idea to have this in stdlib, but you can
definitely write your own to solve the problem :)
package main
import (
"fmt"
)
func Printfln(format string, a ...interface{}) {
fmt.Printf(format + "\n", a...)
}
func main() {
Printfln("%s is awesome!", "Go")
fmt.Println("yu
And a little better way to create `numMem`
https://play.golang.org/p/fAWgSpi2CKR
On Wednesday, 23 May 2018 12:55:49 UTC+5:30, Karan Chaudhary wrote:
>
> One other simpler (and not so elegant) solution is to use separate set for
> each element.
>
> https://play.golang.org/p/9ZSRfAyOX4-
>
> @Baku
One other simpler (and not so elegant) solution is to use separate set for
each element.
https://play.golang.org/p/9ZSRfAyOX4-
@Bakul's solution sounds good but haven't tried to understand it clearly.
On Wednesday, 23 May 2018 11:46:15 UTC+5:30, Sankar wrote:
>
> Use an array instead of a sl
33 matches
Mail list logo