No description
Find a file
Carlos Nihelton 5c49d26cf9
feat: Adds the hostname command to the translation table (#143)
(reopening because I merged on top of the wrong branch 🙈 )

In the GoWSL mock.
That's needed in some test code outside of this repo.
I have this in an ongoing PR in UP4W and need this fix to move forward:

```
--- FAIL: TestDatabaseGetUnmanaged (0.00s)
    --- FAIL: TestDatabaseGetUnmanaged/empty_database (0.00s)
panic: WslLaunch command not supported: hostname [recovered]
	panic: WslLaunch command not supported: hostname
	

goroutine 21 [running]:
testing.tRunner.func1.2({0xd84d40, 0xc000332480})
	/usr/lib/go-1.24/src/testing/testing.go:1734 +0x3eb
testing.tRunner.func1()
	/usr/lib/go-1.24/src/testing/testing.go:1737 +0x696
panic({0xd84d40?, 0xc000332480?})
	/usr/lib/go-1.24/src/runtime/panic.go:792 +0x132
github.com/ubuntu/gowsl/mock.newMockedCommand({0xe862d3, 0x8})
	/home/.../go/pkg/mod/github.com/ubuntu/gowsl@v0.0.0-20250220202122-f4267f82434b/mock/command.go:34 +0x165
github.com/ubuntu/gowsl/mock.(*Backend).WslLaunch...
```
2025-10-03 10:02:59 -03:00
.github Sets up CI for using a real image 2025-10-02 16:43:41 -03:00
examples Corrected typos: succes -> success 2023-03-16 13:50:26 +01:00
internal Prevents aliasing built-in len() 2025-10-02 16:43:42 -03:00
mock Adds the hostname command to the translation table 2025-10-02 17:05:35 -03:00
.gitignore Added executables to .gitignore 2023-01-05 11:15:28 +01:00
.golangci.yaml Slightly modernizes golangci options 2025-10-02 16:43:42 -03:00
backend_mock.go GoWSL calls to wsl.exe return ErrNotExist 2024-03-12 17:01:04 +01:00
backend_real.go GoWSL calls to wsl.exe return ErrNotExist 2024-03-12 17:01:04 +01:00
CONTRIBUTING.md Applied suggestions in CONTRIBUTING.md 2023-01-27 17:16:19 +01:00
coverage.ps1 Set WSL to UTF8 for coverage reports 2022-11-18 17:16:24 +01:00
distro.go Make sure all distro name comparisons are case insensitive 2025-02-13 17:00:35 -03:00
distro_test.go Get rid of the empty rootFS 2025-10-02 16:43:40 -03:00
doc.go Improved package docs 2023-05-09 11:27:43 +02:00
exec.go Adds missing reasons for nolints 2025-10-02 16:43:42 -03:00
exec_test.go Adds missing reasons for nolints 2025-10-02 16:43:42 -03:00
go.mod Bump golang.org/x/sys from 0.29.0 to 0.30.0 2025-02-14 03:21:12 +00:00
go.sum Bump golang.org/x/sys from 0.29.0 to 0.30.0 2025-02-14 03:21:12 +00:00
LICENSE MIT Licensing 2023-01-17 13:35:12 +01:00
main_test.go Get rid of the empty rootFS 2025-10-02 16:43:40 -03:00
README.md Fix code quality status badge 2023-07-10 12:44:35 +02:00
registration.go Make sure all distro name comparisons are case insensitive 2025-02-13 17:00:35 -03:00
registration_test.go Fix TestImport still relying on empty tarballs 2025-10-02 16:43:43 -03:00
shell.go Registry calls are protected and may return ErrNotExist 2024-03-12 17:01:07 +01:00
shell_test.go Fix TestShell timeouts 2024-12-05 16:09:39 -03:00
utils_cleanup_linux_test.go Educated guess about fixing CI error 0x8000000d 2025-02-13 22:21:00 -03:00
utils_cleanup_mock_test.go Educated guess about fixing CI error 0x8000000d 2025-02-13 22:21:00 -03:00
utils_cleanup_windows_test.go Educated guess about fixing CI error 0x8000000d 2025-02-13 22:21:00 -03:00
utils_mock_test.go Update testutils to new DefaultDistro signature 2024-03-01 10:43:13 +01:00
utils_real_test.go Sprinkles some CommandContext to get rid of 2025-10-02 16:43:41 -03:00
utils_test.go Adds missing reasons for nolints 2025-10-02 16:43:42 -03:00

GoWSL

This module offers an idiomatic interface between your Go code and the Windows Subsystem for Linux (WSL) API (wslApi.dll and occasionally wsl.exe). It offers wrappers around common actions to manage WSL distros.

Code quality Go Reference Go Report Card License

Aim

We aim not to extend the aforementioned API, but rather to provide a safe, idiomatic, and easy-to-use wrapper around it. The goal is to enable the development of applications that build on top of it.

Requirements

  • Windows Subsystem for Linux must be installed (documentation) and enabled.
  • Go version must be equal to or above 1.20.

Development

Your help would be very much appreciated! Check out the CONTRIBUTING document to see how you could collaborate.

Contact

You are welcome to create a new issue on this repository if you find bugs or wish to make any feature request.