Compare commits

..

No commits in common. "798b8ec39b29dc0b75f5c7709511963e496efb82" and "12f83f6286d489b477d113bc0ea4d20c6732eaef" have entirely different histories.

8 changed files with 5 additions and 66 deletions

View File

@ -49,4 +49,4 @@ WORKDIR /app
# Install go dependencies, build the wasm module, push it to the registry # Install go dependencies, build the wasm module, push it to the registry
#CMD ["sh", "-c", "go mod download && go mod verify && go mod tidy && wash build && wash push $REGISTRY build/*_s.wasm"] #CMD ["sh", "-c", "go mod download && go mod verify && go mod tidy && wash build && wash push $REGISTRY build/*_s.wasm"]
CMD ["sh", "-c", "go env -w GOFLAGS=-buildvcs=false && go mod download && go mod verify && wash build && wash push $REGISTRY build/.wasm"] CMD ["sh", "-c", "go env -w GOFLAGS=-buildvcs=false && go mod download && go mod verify && wash build && wash push $REGISTRY build/*_s.wasm"]

View File

@ -9,8 +9,6 @@ import (
// ConfigError represents the variant "wasi:config/runtime@0.2.0-draft#config-error". // ConfigError represents the variant "wasi:config/runtime@0.2.0-draft#config-error".
// //
// An error type that encapsulates the different errors that can occur fetching config
//
// variant config-error { // variant config-error {
// upstream(string), // upstream(string),
// io(string), // io(string),
@ -18,11 +16,6 @@ import (
type ConfigError cm.Variant[uint8, string, string] type ConfigError cm.Variant[uint8, string, string]
// ConfigErrorUpstream returns a [ConfigError] of case "upstream". // ConfigErrorUpstream returns a [ConfigError] of case "upstream".
//
// This indicates an error from an "upstream" config source.
// As this could be almost _anything_ (such as Vault, Kubernetes ConfigMaps, KeyValue
// buckets, etc),
// the error message is a string.
func ConfigErrorUpstream(data string) ConfigError { func ConfigErrorUpstream(data string) ConfigError {
return cm.New[ConfigError](0, data) return cm.New[ConfigError](0, data)
} }
@ -33,14 +26,6 @@ func (self *ConfigError) Upstream() *string {
} }
// ConfigErrorIO returns a [ConfigError] of case "io". // ConfigErrorIO returns a [ConfigError] of case "io".
//
// This indicates an error from an I/O operation.
// As this could be almost _anything_ (such as a file read, network connection, etc),
// the error message is a string.
// Depending on how this ends up being consumed,
// we may consider moving this to use the `wasi:io/error` type instead.
// For simplicity right now in supporting multiple implementations, it is being left
// as a string.
func ConfigErrorIO(data string) ConfigError { func ConfigErrorIO(data string) ConfigError {
return cm.New[ConfigError](1, data) return cm.New[ConfigError](1, data)
} }
@ -62,8 +47,6 @@ func (v ConfigError) String() string {
// Get represents the imported function "get". // Get represents the imported function "get".
// //
// Gets a single opaque config value set at the given key if it exists
//
// get: func(key: string) -> result<option<string>, config-error> // get: func(key: string) -> result<option<string>, config-error>
// //
//go:nosplit //go:nosplit
@ -75,8 +58,6 @@ func Get(key string) (result cm.Result[OptionStringShape, cm.Option[string], Con
// GetAll represents the imported function "get-all". // GetAll represents the imported function "get-all".
// //
// Gets a list of all set config data
//
// get-all: func() -> result<list<tuple<string, string>>, config-error> // get-all: func() -> result<list<tuple<string, string>>, config-error>
// //
//go:nosplit //go:nosplit

View File

@ -2,10 +2,10 @@ package wasmcloud:component-go@0.1.0;
package wasmcloud:hello { package wasmcloud:hello {
world hello { world hello {
import wasi:config/runtime@0.2.0-draft;
import wasmcloud:messaging/types@0.2.0; import wasmcloud:messaging/types@0.2.0;
import wasmcloud:messaging/consumer@0.2.0; import wasmcloud:messaging/consumer@0.2.0;
import wasi:logging/logging@0.1.0-draft; import wasi:logging/logging@0.1.0-draft;
import wasi:config/runtime@0.2.0-draft;
import wasi:io/poll@0.2.0; import wasi:io/poll@0.2.0;
import wasi:clocks/monotonic-clock@0.2.0; import wasi:clocks/monotonic-clock@0.2.0;
import wasi:io/error@0.2.0; import wasi:io/error@0.2.0;
@ -115,27 +115,11 @@ package wasi:clocks@0.2.0 {
package wasi:config@0.2.0-draft { package wasi:config@0.2.0-draft {
interface runtime { interface runtime {
/// An error type that encapsulates the different errors that can occur fetching config
variant config-error { variant config-error {
/// This indicates an error from an "upstream" config source.
/// As this could be almost _anything_ (such as Vault, Kubernetes ConfigMaps, KeyValue
/// buckets, etc),
/// the error message is a string.
upstream(string), upstream(string),
/// This indicates an error from an I/O operation.
/// As this could be almost _anything_ (such as a file read, network connection, etc),
/// the error message is a string.
/// Depending on how this ends up being consumed,
/// we may consider moving this to use the `wasi:io/error` type instead.
/// For simplicity right now in supporting multiple implementations, it is being left
/// as a string.
io(string), io(string),
} }
/// Gets a single opaque config value set at the given key if it exists
get: func(key: string) -> result<option<string>, config-error>; get: func(key: string) -> result<option<string>, config-error>;
/// Gets a list of all set config data
get-all: func() -> result<list<tuple<string, string>>, config-error>; get-all: func() -> result<list<tuple<string, string>>, config-error>;
} }
} }

View File

@ -1,7 +1,7 @@
apiVersion: core.oam.dev/v1beta1 apiVersion: core.oam.dev/v1beta1
kind: Application kind: Application
metadata: metadata:
name: go-data-stream name: tinygo-hello-world
annotations: annotations:
description: 'HTTP hello world demo in Golang (TinyGo), using the WebAssembly Component Model and WebAssembly Interfaces Types (WIT)' description: 'HTTP hello world demo in Golang (TinyGo), using the WebAssembly Component Model and WebAssembly Interfaces Types (WIT)'
wasmcloud.dev/authors: wasmCloud team wasmcloud.dev/authors: wasmCloud team

View File

@ -2,15 +2,6 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 1 version = 1
[[packages]]
name = "wasi:config"
registry = "wasi.dev"
[[packages.versions]]
requirement = "=0.2.0-draft"
version = "0.2.0-draft"
digest = "sha256:aa2d36d0843999edad80a13bf22f4529277f7b6012429f8a5d1f9499f3793c1a"
[[packages]] [[packages]]
name = "wasi:logging" name = "wasi:logging"
registry = "wasi.dev" registry = "wasi.dev"

View File

@ -1,4 +1,4 @@
name = "go_nats_stream_client" name = "go_nats_client"
language = "tinygo" language = "tinygo"
type = "component" type = "component"
version = "1.0.0" version = "1.0.0"
@ -6,7 +6,7 @@ version = "1.0.0"
[component] [component]
wit_world = "hello" wit_world = "hello"
wasm_target = "wasm32-wasip2" wasm_target = "wasm32-wasip2"
destination = "build/go_nats_stream_client.wasm" destination = "build/go_nats_client_s.wasm"
[registry] [registry]
url = "gitea.rebus.ninja/lore" url = "gitea.rebus.ninja/lore"

View File

@ -1,28 +1,13 @@
package wasi:config@0.2.0-draft; package wasi:config@0.2.0-draft;
interface runtime { interface runtime {
/// An error type that encapsulates the different errors that can occur fetching config
variant config-error { variant config-error {
/// This indicates an error from an "upstream" config source.
/// As this could be almost _anything_ (such as Vault, Kubernetes ConfigMaps, KeyValue buckets, etc),
/// the error message is a string.
upstream(string), upstream(string),
/// This indicates an error from an I/O operation.
/// As this could be almost _anything_ (such as a file read, network connection, etc),
/// the error message is a string.
/// Depending on how this ends up being consumed,
/// we may consider moving this to use the `wasi:io/error` type instead.
/// For simplicity right now in supporting multiple implementations, it is being left as a string.
io(string), io(string),
} }
/// Gets a single opaque config value set at the given key if it exists
get: func(key: string) -> result<option<string>, config-error>; get: func(key: string) -> result<option<string>, config-error>;
/// Gets a list of all set config data
get-all: func() -> result<list<tuple<string, string>>, config-error>; get-all: func() -> result<list<tuple<string, string>>, config-error>;
} }
world imports {
import runtime;
}

View File

@ -3,8 +3,6 @@ package wasmcloud:hello;
world hello { world hello {
include wasmcloud:component-go/imports@0.1.0; include wasmcloud:component-go/imports@0.1.0;
import wasi:config/runtime@0.2.0-draft;
export wasmcloud:messaging/handler@0.2.0; export wasmcloud:messaging/handler@0.2.0;
import wasmcloud:messaging/consumer@0.2.0; import wasmcloud:messaging/consumer@0.2.0;
import wasi:logging/logging@0.1.0-draft; import wasi:logging/logging@0.1.0-draft;