Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: build pocketbase failed: github.com/pocketbase/pocketbase/models/schema internal compiler error: panic: interface conversion: interface {} is string, not syntax.writeError #142

Closed
xhd2015 opened this issue May 23, 2024 · 3 comments
Labels
bug Something isn't working CI
Milestone

Comments

@xhd2015
Copy link
Owner

xhd2015 commented May 23, 2024

$ git clone https://github.com/pocketbase/pocketbase
$ cd pocketbase
$ xgo test -v ./...

# github.com/pocketbase/pocketbase/models/schema
<unknown line number>: internal compiler error: panic: interface conversion: interface {} is string, not syntax.writeError
Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new

Raised by PR: #141

From action: https://github.com/xhd2015/xgo/actions/runs/9209266281/job/25333420028?pr=141

A proof of power of nightly build: #123

@xhd2015 xhd2015 added bug Something isn't working CI labels May 23, 2024
@xhd2015 xhd2015 added this to the v1.1.0 milestone May 23, 2024
@xhd2015
Copy link
Owner Author

xhd2015 commented May 24, 2024

The following code from hugoio/hugo also fails to build:

file: https://github.com/gohugoio/hugo/blob/7f3061723e3df064515fc57c183b06ed16f26b75/tpl/math/round.go#L52

package hugoio

const (
	bias  = 1023
	shift = 64 - 11 - 1
)

func round(x float64) {
	var e uint

	if e < bias+shift {
	}
}

Message:

 with-go1.22 xgo test -v --project-dir runtime/test/bugs/hugoio
# github.com/xhd2015/xgo/runtime/test/bugs/hugoio [github.com/xhd2015/xgo/runtime/test/bugs/hugoio.test]
<unknown line number>: internal compiler error: panic: interface conversion: interface {} is string, not syntax.writeError

Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new
FAIL    github.com/xhd2015/xgo/runtime/test/bugs/hugoio [build failed]
exit status 1

The line that causes error: if e < bias+shift {

@xhd2015
Copy link
Owner Author

xhd2015 commented May 24, 2024

As for the pocketbase, the following code fails to build:
https://github.com/pocketbase/pocketbase/blob/4937acb3e2685273998506b715e2b54e33174172/models/schema/schema_field.go#L591

// see https://github.com/xhd2015/xgo/issues/142
package pocketbase

const DefaultDateLayout = "2006-01-02 15:04:05.000Z"

func chainedConst() {
	// the problem only appears when chained const with
	// following call with arg
	wrap(DefaultDateLayout).Min(nil)
}

func wrap(e string) interface{ Min(t interface{}) } {
	return nil
}
 with-go1.22 go run -tags dev ./cmd/xgo build -v --project-dir runtime/test/bugs/pocketbase
github.com/xhd2015/xgo/runtime/test/bugs/pocketbase
# github.com/xhd2015/xgo/runtime/test/bugs/pocketbase
<unknown line number>: internal compiler error: panic: interface conversion: interface {} is string, not syntax.writeError

Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new

The line that causes error: wrap(DefaultDateLayout).Min(nil)

@xhd2015 xhd2015 closed this as completed May 24, 2024
@xhd2015
Copy link
Owner Author

xhd2015 commented May 24, 2024

Addressed in #145

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CI
Projects
Status: Done
Development

No branches or pull requests

1 participant