tinygo-org / drivers

TinyGo drivers for sensors, displays, wireless adaptors, and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.
https://tinygo.org
BSD 3-Clause "New" or "Revised" License
622 stars 196 forks source link

compiler error while importing tinygo.org/x/drivers/ssd1306: expected 'package', found 'EOF' #685

Closed BryanSouza91 closed 5 months ago

BryanSouza91 commented 5 months ago

I get this error when trying to flash:

$ tinygo flash -target=nodemcu -port=/dev/ttyUSB0 examples/ssd1306      
../../../go/pkg/mod/tinygo.org/x/drivers@v0.27.0/ssd1306/registers.go:1:1: expected 'package', found 'EOF'

I have tried many solutions found when searching for this error. I have run into this error previously with non-tinygo projects and was able to fix the issue however I am unable to do so with this issue.

go.mod

module ssd1306
go 1.22.3
require tinygo.org/x/drivers v0.27.0

go.sum

tinygo.org/x/drivers v0.27.0 h1:TEGk1lQvEhXxfvpEhUu+pwmCnhtldPI+hpHlO9VYixI=
tinygo.org/x/drivers v0.27.0/go.mod h1:q/mU8G/wz821p8xXqbkBACOlmZFDHXd//DnYnCW+dDQ=
$ tinygo info -target=nodemcu
LLVM triple:       xtensa
GOOS:              linux
GOARCH:            arm
build tags:        xtensa baremetal linux arm esp8266 esp nodemcu tinygo purego math_big_pure_go gc.conservative scheduler.tasks serial.uart
garbage collector: conservative
scheduler:         tasks
cached GOROOT:     /home/bryansouza/.cache/tinygo/goroot-ef106e068c9f67ad57092cc9befb16284ba02816acb59341c17f2fda4a265afd
aykevl commented 5 months ago

It looks like there's something wrong with your system that caused the file to be empty. Because it really isn't. Can you try go clean -modcache and see if that helps?

BryanSouza91 commented 5 months ago

I ran go clean -modcache with no change. I also reinitialized my module multiple times cleaning the modcache each time. You are correct the file is not empty. I even deleted the registers.go file and remade it with no change.

I am on Gentoo Linux if that matters at all.

BryanSouza91 commented 5 months ago

I just checked it again today and it seems to be working correctly now.