ClickHouse/ch-go

go1.18.4, go1.19: internal compiler error: assertion failed

qcloutier-sonrai opened this issue · 8 comments

Not sure if this is a bug here or with the go compiler itself, but I get the following error when building in a Docker container:

/home/circleci/go/pkg/mod/github.com/!click!house/ch-go@v0.47.0/proto/col_map.go:124:11: internal compiler error: assertion failed

Minimal Dockerfile to reproduce:

FROM golang:1.18
WORKDIR /project
COPY . .
RUN go build -v .

main.go (same as the example in the README):

package main

import (
  "context"
  "fmt"

  "github.com/ClickHouse/ch-go"
  "github.com/ClickHouse/ch-go/proto"
)

func main() {
  ctx := context.Background()
  c, err := ch.Dial(ctx, ch.Options{Address: "localhost:9000"})
  if err != nil {
    panic(err)
  }
  var (
    numbers int
    data    proto.ColUInt64
  )
  if err := c.Do(ctx, ch.Query{
    Body: "SELECT number FROM system.numbers LIMIT 500000000",
    Result: proto.Results{
      {Name: "number", Data: &data},
    },
    // OnResult will be called on next received data block.
    OnResult: func(ctx context.Context, b proto.Block) error {
      numbers += len(data)
      return nil
    },
  }); err != nil {
    panic(err)
  }
  fmt.Println("numbers:", numbers)
}

I've got this error on go1.19, are you sure that you are using go1.18 Docker?

Yeah it's the official golang:1.18 image. I tried a couple others too, same result.

Please try golang:1.18.3 for now, looks like golang:1.18.4 has some kind of compiler bug, I'll try to find a workaround

Ah whoops, didn't realize there was a patch release the other day... and sure enough, 1.18.3 works fine. Thanks!

Is this a known bug in Go compiler? any issue about it?

I've asked @tdakkota to take a look

I suppose it's the same problem as golang/go#53852.

This is fixed in go1.18.5, go1.19.0.