Hello,
> but this doesn't work:
>
> if err := json.NewDecoder(resp.Body).Decode({}{}); err != nil {
> t.Fatal(err)
> }
You can use new(interface{}).
See https://play.golang.org/p/s85MwlDygBG
Harald
--
You received this message because you are subscribed to the Google Groups
Hello,
> Why is this not allowed?
>
> s := "hello"
> s[0] = 'a' // compile error: cannot assign to s[0]
Because strings are immutable in Go. See
https://golang.org/ref/spec#String_types
You can construct a new string, or convert to byte slive and back.
Hello,
> A typical computer keyboard provides four easily accessible pairs of
> single-character symmetrical "brackets": parentheses ( and ), square
> brackets [ and ], curly braces { and }, and angle brackets < and >. Go uses
> curly braces to delineate code blocks, composite literals, and some
Hello,
> But the following code also fails to compile, bug?
>
> package main
>
> type Int interface {
> type int
> }
>
> func Foo(type T Int) ([]T) {} // undefined: MyInt
>
> func main() {
> type MyInt int
> Foo([]MyInt(nil))
> }
It compiles if you move "type MyInt int" out of the
Hello,
> Here is the playground: https://go2goplay.golang.org/p/CVvUuNJVX-M
> I am unable to make this example to compile.
This one compiles:
https://go2goplay.golang.org/p/2rmaCymukdv
Regards,
Harald
--
You received this message because you are subscribed to the Google Groups
"golang-nuts"
Hello,
> There is an existing case which doesn't seem to bother many people:
>
> foo.Bar()
>
> Is this calling function Bar in package foo, or method Bar on variable
> foo?
It could also be a call of a function within the struct value foo.
foo.Bar(baz) can have at least four meanings:
1.
Hello,
On Wed, Apr 08, 2020 at 06:00:19AM -0700, Tanmay Das wrote:
> go run helloworld.go
>
> Strangely the code didn't run. In fact, the terminal prompt never exited. I
> kept running the same command over and over again but no luck.
You can run "go run -x helloworld.go" to see what the
Hello,
> I'm not sure if that is a good idea
> https://play.golang.org/p/Mj77pgsaVsB
This is why three-index slices were added in Go 1.2.
https://play.golang.org/p/_sJ9OKWsvMz
https://golang.org/doc/go1.2#three_index
Regards,
Harald
--
You received this message because you are subscribed
Hello,
On Thu, Apr 25, 2019 at 08:54:57AM -0700, Ian Lance Taylor wrote:
> On Thu, Apr 25, 2019 at 8:29 AM JuciÊ Andrade wrote:
> >
> > These are the ones I am aware of:
> >
> > . GC toolchain
> > . GCC
> > . gopherjs
> >
> > By Go compiler I mean any tool that understands Go source files and
>
Hello,
> I was trying to get a list of undefined and implementation defined
> behaviors of the Go language from the specification, but it was not easy.
> I tried to search for "undefined behavior" and "implementation defined
> behavior" without success.
[...]
> Is this list complete?
The
Hallo,
On Fri, Oct 19, 2018 at 11:45:04AM -0700, Ian Lance Taylor wrote:
> > Unhelpfully, I imagine it unlikely that anyone distributing binary go
> > packages reads golang-dev or golang-nuts.
>
> Is there a more likely place to reach such people?
I believe the best ways to reach attention on
Hello,
On Mon, Sep 19, 2016 at 01:37:14AM -0700, loc...@gmail.com wrote:
> import(
> _ "github.com/go-sql-driver"
> )
The correct name of this package is: github.com/go-sql-driver/mysql
Harald
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
Hello,
On Thu, Sep 01, 2016 at 01:59:12AM -0700, Muhammad Shulhan wrote:
> > type Slices []string
> >
> > func (sl *Slices) String() string {
> > return fmt.Sprint(sl)
> > }
> runtime: goroutine stack exceeds 25000-byte limit
> fatal error: stack overflow
It is always dangerous to
Hello,
On Tue, Aug 30, 2016 at 04:41:29PM -0700, 'Eric Johnson' via golang-nuts wrote:
> I looked at the k-nucleotide program, and was unable to figure out a way to
> make it faster.
> This is, of course, exactly what the test is suppose to be checking - the
> speed of the built in map. Anyone
14 matches
Mail list logo