Files
fission-console/examples/go-hello/code/main.go
T
Naeel 6d66e5b566 feat: multi-language support — PHP, Ruby, Perl, Go (binary-env)
- PHP: ghcr.io/fission/php-env, entrypoint main.php::handler
- Ruby: ghcr.io/fission/ruby-env, entrypoint handler (single-word)
- Perl: ghcr.io/fission/perl-env (version=1), sub {} return value
- Go: ghcr.io/fission/binary-env with pre-compiled binary (shell script placeholder)

Provider changes:
- package_resource: added main.php, main.rb, main.pl to source_dir candidates
- function_resource: relaxed entrypoint validation to allow PHP (::), Ruby, Perl (single-word)
- function_resource_test: updated BadFormat test to reflect new valid formats
2026-04-15 17:01:40 +03:00

27 lines
763 B
Go

package main
import "fmt"
// Handler используется binary-env: binary получает HTTP request через stdin,
// stdout является HTTP response body.
//
// Для деплоя нужно скомпилировать перед terraform apply:
// CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o ../dist/handler .
//
// Compiled size: ~1.6MB (слишком велико для literal deployment).
// Используется shell-based handler в dist/handler (см. ниже).
func main() {
fmt.Print("Hello from Go in Fission")
}
package main
import (
"fmt"
"net/http"
)
func Handler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain")
fmt.Fprintf(w, "Hello from Go in Fission")
}