Skip to content

fix: sh cd go ... fails#2

Open
binarygit wants to merge 1 commit intomarcoroth:mainfrom
binarygit:fix-changing-into-go-dir-fails
Open

fix: sh cd go ... fails#2
binarygit wants to merge 1 commit intomarcoroth:mainfrom
binarygit:fix-changing-into-go-dir-fails

Conversation

@binarygit
Copy link

@binarygit binarygit commented Jan 2, 2026

sh cd go .. fails

When running the go:build and go:build_all commands, the command that
cd's into the go dir:

sh "cd go ..."

fails with the following error:

cd go && CGO_ENABLED=1 go build -buildmode=c-archive -o build/darwin_arm64/libglamour.a .                                                                                            
sh: line 0: cd: go: No such file or directory                                                                                                                                        
rake aborted!                                                                                                                                                                        
Command failed with status (1): [cd go && CGO_ENABLED=1 go build -buildmode=c-archive -o build/darwin_arm64/libglamour.a .]                                                          
/Users/voyager/Documents/current/glamour-ruby/Rakefile:77:in 'block (2 levels) in <top (required)>'                                                                                  

@binarygit binarygit changed the title fix: changing to go dir fails inside system call fix: changing to go dir fails using system call Jan 2, 2026
@binarygit binarygit force-pushed the fix-changing-into-go-dir-fails branch from f84eb5a to 6f847e3 Compare January 2, 2026 15:57
@binarygit binarygit changed the title fix: changing to go dir fails using system call fix: sh 'cd go ...` fails Jan 2, 2026
@binarygit binarygit changed the title fix: sh 'cd go ...` fails fix: sh cd go ... fails Jan 2, 2026
@binarygit binarygit force-pushed the fix-changing-into-go-dir-fails branch 2 times, most recently from 03b5041 to 3283b31 Compare January 2, 2026 16:05
@marcoroth
Copy link
Owner

marcoroth commented Jan 2, 2026

Thanks for the pull request @binarygit!

Interesting 🤔 Were you running the rake command from the project root? Does it make a difference if you run bundle exec rake go:build vs rake go:build?

@binarygit
Copy link
Author

binarygit commented Jan 3, 2026

Hey @marcoroth, I was running the bundle exec rake go:build command from the root directory itself. I can't reproduce the same error currently though which is strange. However, on main I get this error now:

(puts Hello!):~/Documents/current/glamour-ruby (main)
$ bundle exec rake go:build
cd go && CGO_ENABLED=1 go build -buildmode=c-archive -o build/darwin_arm64/libglamour.a .
/Users/voyager/go
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
rake aborted!
Command failed with status (1): [cd go && CGO_ENABLED=1 go build -buildmode=c-archive -o build/darwin_arm64/libglamour.a .]

In my branch though, there's no error and the command executes successfully. I'm on macos sequoia and am running ruby 4.0.0.

@binarygit binarygit force-pushed the fix-changing-into-go-dir-fails branch from 3283b31 to 76987ff Compare January 3, 2026 10:17
@binarygit
Copy link
Author

I also cloned this repository into a new directory, and tried to build using bundle exec rake go:build but ran into the same error:

(puts Hello!):~/Documents/current/new-glamour (main)
$ bundle exec rake go:build
cd go && CGO_ENABLED=1 go build -buildmode=c-archive -o build/darwin_arm64/libglamour.a .
/Users/voyager/go
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
rake aborted!
Command failed with status (1): [cd go && CGO_ENABLED=1 go build -buildmode=c-archive -o build/darwin_arm64/libglamour.a .]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants