Skip to content

fix: bring os_js.go up to date with os.go#192

Open
paralin wants to merge 1 commit intogo-git:mainfrom
paralin:fix-os-js
Open

fix: bring os_js.go up to date with os.go#192
paralin wants to merge 1 commit intogo-git:mainfrom
paralin:fix-os-js

Conversation

@paralin
Copy link
Copy Markdown
Contributor

@paralin paralin commented Apr 2, 2026

Recent changes to os_js.go added WithBoundOS and ChrootOSFS.

These changes were not propagated to os_js.go, which results in the following build failures in go-git:

% GOOS=js GOARCH=wasm gb ./...
github.com/go-git/go-git/v6
./remote.go:214:32: undefined: osfs.WithBoundOS
./repository.go:348:29: undefined: osfs.WithBoundOS ./repository.go:353:28: undefined: osfs.WithBoundOS ./repository.go:460:28: undefined: osfs.WithBoundOS ./repository.go:468:44: undefined: osfs.WithBoundOS ./repository.go:528:32: undefined: osfs.WithBoundOS ./repository.go:531:46: undefined: osfs.WithBoundOS ./repository.go:551:36: undefined: osfs.WithBoundOS ./repository.go:553:62: undefined: osfs.WithBoundOS

This commit brings os_js.go up to date with os.go to fix this.

All tests pass with GOOS=js GOARCH=wasm now.

Copilot AI review requested due to automatic review settings April 2, 2026 17:53
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR syncs the GOOS=js implementation of osfs with the non-js osfs API by adding missing options/types (notably WithBoundOS), fixing js/wasm build failures in downstream consumers (e.g., go-git).

Changes:

  • Updated osfs/os_js.go to include WithBoundOS, WithChrootOS, option plumbing, and BoundOS/ChrootOS implementations consistent with non-js builds.
  • Changed js Default to a *ChrootOS (backed by a shared global memfs) and expanded the js implementation to support the newer API surface.
  • Updated/added js tests to reflect the new Default type and to assert WithBoundOS() returns a *BoundOS.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
osfs/os_js.go Adds missing js/wasm API parity for WithBoundOS and introduces BoundOS/ChrootOS implementations backed by memfs.
osfs/os_js_test.go Updates Default type expectations and adds a test to ensure WithBoundOS() selects BoundOS.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread osfs/os_js.go Outdated
Comment thread osfs/os_js.go
Comment thread osfs/os_js.go Outdated
@paralin
Copy link
Copy Markdown
Contributor Author

paralin commented Apr 8, 2026

@pjbgf comments addressed!

Recent changes to os_js.go added WithBoundOS and ChrootOSFS.

These changes were not propagated to os_js.go, which results in
the following build failures in go-git:

% GOOS=js GOARCH=wasm gb ./...
github.com/go-git/go-git/v6
./remote.go:214:32: undefined: osfs.WithBoundOS
./repository.go:348:29: undefined: osfs.WithBoundOS
./repository.go:353:28: undefined: osfs.WithBoundOS
./repository.go:460:28: undefined: osfs.WithBoundOS
./repository.go:468:44: undefined: osfs.WithBoundOS
./repository.go:528:32: undefined: osfs.WithBoundOS
./repository.go:531:46: undefined: osfs.WithBoundOS
./repository.go:551:36: undefined: osfs.WithBoundOS
./repository.go:553:62: undefined: osfs.WithBoundOS

This commit brings os_js.go up to date with os.go to fix this.

All tests pass with GOOS=js GOARCH=wasm now.

Signed-off-by: Christian Stewart <christian@aperture.us>
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.

3 participants