# Build error with Go

**URL:** <https://forum.codecrafters.io/t/build-error-with-go/620>\
**Category:** Bug Reports\
**Tags:** challenge:sqlite\
**Created:** [June 4, 2024, 7:33am UTC](https://forum.codecrafters.io/t/build-error-with-go/620 "2024-06-04T07:33:36Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![EshaanAgg](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/eshaanagg/32/399_2.png) [@EshaanAgg](https://forum.codecrafters.io/u/EshaanAgg)\
**Post date:** [June 4, 2024, 7:33am UTC](https://forum.codecrafters.io/t/build-error-with-go/620/1 "2024-06-04T07:33:36Z")

</div>

I’m stuck on stage `#CE0` (Print number of tables)

When I am pushing my code to the tester, the following logs appear:

```auto
remote: ------------------------------------------------------------------------
remote: 
remote: 
remote: _______ __ _                   
remote: / __\___  __| |___ / __\___  ___ / _|| |____ _ _____ 
remote: / / / _ \ / _` | / _ \ / / | ' __|/ _` || |_ |__ |/ _ \| ' __|/__ |
remote: / /___| (_) || (_| ||__// /___| | | (_| || _|| |_|__/| | \__ 
remote: \ ____/ \___ / \ __,_| \___ |\ ____/|_| \__ ,_||_| \ __|\___ ||_| |___/
remote: 
remote: 
remote: Welcome to CodeCrafters! Your commit was received successfully.
remote: 
remote: ------------------------------------------------------------------------
remote: 
remote: Welcome back! Your first build could take slightly longer, please bear with us.
remote: Subsequent ones will be snappy ⚡
remote: 
remote: Streaming build logs...
remote: 
remote: [build] Starting build...
remote: [build] If you don't see logs for 60s+, please contact us at hello@codecrafters.io
remote: [build] Step 1 complete.
remote: [build] Step 2 complete.
remote: [build] Step 3 complete.
remote: [build] Step 4 complete.
remote: [build] Step 5 complete.
remote: [build] Step 6 complete.
remote: [build] Step 7 complete.
remote: [build] Step 8 complete.
remote: [build] Step 7 complete.
remote: [build] Step 9 complete.
remote: [build] Step 10 complete.
remote: [build] Step 11 complete.
remote: [build] Step 12 complete.
remote: [build] Step 13 complete.
remote: [build] > + go mod graph
remote: [build] > + awk '{if ($1 !~ "@") {print $2}}'
remote: [build] > + xargs -r go get
remote: [build] Step 14 complete.
remote: [build] > fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/APKINDEX.tar.gz
remote: [build] > fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/community/x86_64/APKINDEX.tar.gz
remote: [build] > (1/13) Upgrading musl (1.2.4-r1 -> 1.2.4-r2)
remote: [build] > (2/13) Upgrading libcrypto3 (3.1.2-r0 -> 3.1.5-r0)
remote: [build] > (3/13) Upgrading libssl3 (3.1.2-r0 -> 3.1.5-r0)
remote: [build] > (4/13) Upgrading ca-certificates (20230506-r0 -> 20240226-r0)
remote: [build] > (5/13) Installing brotli-libs (1.0.9-r14)
remote: [build] > (6/13) Installing libunistring (1.1-r1)
remote: [build] > (7/13) Installing libidn2 (2.3.4-r1)
remote: [build] > (8/13) Installing nghttp2-libs (1.57.0-r0)
remote: [build] > (9/13) Installing libcurl (8.5.0-r0)
remote: [build] > (10/13) Installing curl (8.5.0-r0)
remote: [build] > (11/13) Installing libexpat (2.6.2-r0)
remote: [build] > (12/13) Installing pcre2 (10.42-r1)
remote: [build] > (13/13) Installing git (2.40.1-r0)
remote: [build] > Executing busybox-1.36.1-r2.trigger
remote: [build] > Executing ca-certificates-20240226-r0.trigger
remote: [build] > OK: 18 MiB in 25 packages
remote: [build] Step 15 complete.
remote: [build] Step 16 complete.
remote: [build] Step 17 complete.
remote: [build] Step 18 complete.
remote: [build] Step 20 complete.
remote: [build] Step 19 complete.
remote: [build] Build successful.
remote: 
remote: 
remote: Running tests on your code. Logs should appear shortly...
remote: 
remote: Debug = true
remote: 
remote: [tester::#CE0] Running tests for Stage #CE0 (Print number of tables)
remote: [tester::#CE0] Creating test database with 2 tables: test.db
remote: [tester::#CE0] $ ./your_sqlite3.sh test.db .dbinfo
remote: [your_program] github/com/codecrafters-io/sqlite-starter-go/app/utils: cannot compile Go 1.22 code
remote: [tester::#CE0] Expected stdout to contain "number of tables: 2", got: ""
remote: [tester::#CE0] Test failed
remote: 
remote: View our article on debugging test failures: https://codecrafters.io/debug
remote: 
To https://git.codecrafters.io/2f9269df826a8d27
   7a228ff..37653bc master -> master

```

As you can see in the logs, the build initially succeeds, but when the tester starts to execute the code, I get the `cannot compile Go 1.22 code` error, which I can’t seem to debug. My code works correctly when I build the CLI on my system and then run the executable with the `.dbinfo` and the next stage’s `.tables` command.

I had initially changed the `go.mod` file (added `stretchr/testify` to make writing unit tests easier), and it seemed to build without any errors in all the previous stages. Upon seeing this error, I reverted the `go.mod` to the one provided in the starter template, but the same error persists. Any help regarding this would be much appreciated!

---

<div class="post-metadata">

**Author:** ![EshaanAgg](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/eshaanagg/32/399_2.png) [@EshaanAgg](https://forum.codecrafters.io/u/EshaanAgg)\
**Post date:** [June 6, 2024, 12:03pm UTC](https://forum.codecrafters.io/t/build-error-with-go/620/2 "2024-06-06T12:03:22Z")

</div>

Hey! Can anyone from the core team take a look at this? Please do let me know if you need some additional context to replicate the same.

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [June 6, 2024, 3:53pm UTC](https://forum.codecrafters.io/t/build-error-with-go/620/3 "2024-06-06T15:53:28Z")

</div>

Hey @EshaanAgg, I haven’t been able to look into this yet, but deleting the current repository and creating a new repository could be a quick workaround: [Can I re-attempt a challenge in a different language? - CodeCrafters](https://docs.codecrafters.io/challenges/reattempt-challenge)

---

<div class="post-metadata">

**Author:** ![EshaanAgg](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/eshaanagg/32/399_2.png) [@EshaanAgg](https://forum.codecrafters.io/u/EshaanAgg)\
**Post date:** [June 8, 2024, 12:13pm UTC](https://forum.codecrafters.io/t/build-error-with-go/620/4 "2024-06-08T12:13:20Z")

</div>

I tried making a new repo and running the same code there. Received the same error.

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [June 10, 2024, 12:25pm UTC](https://forum.codecrafters.io/t/build-error-with-go/620/5 "2024-06-10T12:25:30Z")

</div>

Hey @EshaanAgg, I was able to replicate this. The bug was related to [cmd/go: improve "toolchain not available" message when patch version is missing · Issue #66175 · golang/go · GitHub](https://github.com/golang/go/issues/66175), which was fixed in 1.22.4. I’ve updated the version our test runner runs now - the fix seems to work on my test repository.

Could you confirm if this works for you?

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [June 10, 2024, 12:26pm UTC](https://forum.codecrafters.io/t/build-error-with-go/620/6 "2024-06-10T12:26:22Z")

</div>

Will mark as closed for now, please do let us know if you run into this again!

---

<div class="post-metadata">

**Author:** ![EshaanAgg](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/eshaanagg/32/399_2.png) [@EshaanAgg](https://forum.codecrafters.io/u/EshaanAgg)\
**Post date:** [June 11, 2024, 6:06am UTC](https://forum.codecrafters.io/t/build-error-with-go/620/7 "2024-06-11T06:06:58Z")

</div>

I can confirm that this worked for me as well. Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [June 18, 2024, 6:07am UTC](https://forum.codecrafters.io/t/build-error-with-go/620/8 "2024-06-18T06:07:22Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
