Go doens't recompile code after first run

Problem description:
When running a golang repl, the program never recompiles after the first run (when it runs make build). You can bypass this by using go run . in the shell to bypass make (this is probably how it should work anyways)

Expected behavior:
When pressing “run”, the code will recompile and reflect my changes

Actual behavior:
When pressing “run”, it runes an old version of the program

Steps to reproduce:
Create a golang program.
Change the program
Recompile - You get the same result as the first comple.

Bug appears at this link:
library/library.go - LibraryApp - Replit
[WIP thing I’m working on, could be used to test this bug I guess]


1 Like

Hey @phixmeplease!

I wasn’t able to reproduce the issue. After forking your Repl, I changed the code and it updated: Loom | Free Screen & Video Recording Software | Loom

If you’re still having issues, would you mind sending me a screen recording (we recommend using loom.com) so I can get a better idea of how the issue occurs on your end?

I’m Japanese and I’m not good at English.
I’m sorry if my English is wrong.

I have a similar problem. ↓This Java Program can’t refresh.
If this new version recompile, old version(default’s “Hello world!”) runs.
I use replit in browser, I don’t know if it’s a browser problem or a problem on the replit side.

I’m not sure if it’s related, but I’m also having the following problem:
Forking the above weird file will generate a garbled “Main.class” at the beginning.

I noticed a few things using the “javap” option.
“Main.java” in the folder cannot be directly compiled with the “Run” button, so it seems that the previous class files are still there and are being run.
The reason why “Main.class” is garbled in the above reply is probably because the class file created when the default was compiled was left and executed.

Also, after running “javac all/Main.java”, running “java all/Main” worked fine.
I’m sorry if it’s a specification that can’t be done with “javac Main.java”.

Hey @CWCW1!

It looks like your “Main.java” file isn’t in the top-level of your Repl. If your “Main.java” file is inside a folder, or you don’t have a “Main.java” file in the root directory of your Repl, we won’t be able to run your code.

You can either:

1 Like

On line 5 Makefile should have this instead of *.go:

$(shell find . -name *.go)

So that all go files are tracked by Makefile, and not just the ones in the root folder.

1 Like

I could only replicate the issue when saving files that weren’t in the root directory, so this answer makes sense. Thanks for the help!

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