1
0
Fork 0
mirror of https://github.com/imjasonh/gos synced 2026-07-07 00:23:42 +00:00
gos/examples/hello.go
Jason Hall 7c7f63bc3a
feat: Add gos test command for running tests in script files
- Add support for `gos test` command to run tests in Go scripts
- Automatically rename non-test files to *_test.go for proper test execution
- Support combined scripts with both main() and test functions
- Update examples to demonstrate testing capabilities
- Document the new test command in README

This allows single Go files to be both runnable scripts and testable,
making gos more versatile for quick Go development.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-21 23:34:42 -04:00

27 lines
457 B
Go
Executable file

#!/usr/bin/env gos run
// /// script
// dependencies = [
// "github.com/fatih/color@v1.18.0",
// "github.com/stretchr/testify@v1.10.0",
// ]
// ///
package main
import (
"fmt"
"os"
"testing"
"github.com/fatih/color"
"github.com/stretchr/testify/assert"
)
func main() {
color.Green("✓ Hello from gos example!")
fmt.Printf("Arguments: %v\n", os.Args[1:])
}
func TestFoo(t *testing.T) {
assert.Equal(t, 1, 1, "This should always pass")
}