repo_name
stringlengths
1
52
repo_creator
stringclasses
6 values
programming_language
stringclasses
4 values
code
stringlengths
0
9.68M
num_lines
int64
1
234k
jsii-rosetta
aws
Go
x := map[string]*string{ "key": jsii.String("value"), }
4
jsii-rosetta
aws
Go
callThisFunction(foo, ...)
2
jsii-rosetta
aws
Go
fmt.Println(enumType_ENUM_VALUE_A)
2
jsii-rosetta
aws
Go
fmt.Println(enumType_ENUM_VALUE_A())
2
jsii-rosetta
aws
Go
map := map[string]interface{}{ "Access-Control-Allow-Origin": jsii.String("\"*\""), }
4
jsii-rosetta
aws
Go
x := someObject.someAttribute
2
jsii-rosetta
aws
Go
object.propertyA object.propertyB
3
jsii-rosetta
aws
Go
x := "world" y := "well" fmt.Println(fmt.Sprintf("Hello, %v, it works %v!", x, y)) // And now a multi-line expression fmt.Println(fmt.Sprintf("\nHello, %v.\n\nIt works %v!\n", x, y))
7
jsii-rosetta
aws
Go
literal := ` This is a multiline string literal. "It's cool!". YEAH BABY!! Litteral \\n right here (not a newline!) `
10
jsii-rosetta
aws
Go
type test struct { key *string } x := &test{ key: jsii.String("value"), }
8
jsii-rosetta
aws
Go
fmt.Println(-3) fmt.Println(!false) fmt.Println(a == b)
4
jsii-rosetta
aws
Go
if true { fmt.Println("everything is well") } onlyToEndOfBlock()
6
jsii-rosetta
aws
Go
foo(jsii.Number(3), ...)
2
jsii-rosetta
aws
Go
prepare() fmt.Println(this, "it seems to work")
4
jsii-rosetta
aws
Go
foo(jsii.Number(3), jsii.Number(8))
2
jsii-rosetta
aws
Go
before() // ... after()
4
jsii-rosetta
aws
Go
foo(jsii.Number(3))
2
jsii-rosetta
aws
Go
import lambda "github.com/aws-samples/dummy/scopeawslambda" lambda.NewClassFromLambda(map[string]*string{ "key": jsii.String("lambda.amazonaws.com"), })
5
jsii-rosetta
aws
Go
import mod "github.com/aws-samples/dummy/scopesomemodule" mod.NewClassFromModule()
3
jsii-rosetta
aws
Go
import mod "github.com/aws-samples/dummy/scopesomemodule" mod.NewClassFromModule()
3
jsii-rosetta
aws
Go
import cdk "github.com/aws-samples/dummy/awscdklib" import "github.com/aws-samples/dummy/constructs"
3
jsii-rosetta
aws
Go
import "github.com/aws-samples/dummy/scopesomemodule" scopesomemodule.NewTwo() scopesomemodule.Four()
4
jsii-rosetta
aws
Go
import "github.com/aws/jsii/jsii-calc/go/jsiicalc/submodule" import "github.com/aws/jsii/jsii-calc/go/jsiicalc/submodule/child" import "github.com/aws/jsii/jsii-calc/go/jsiicalc" import "github.com/aws/jsii/jsii-calc/go/jsiicalc/foo" import "github.com/aws-samples/dummy/gen/providers/aws/kms" // Access without existin...
24
jsii-rosetta
aws
Go
type iThing interface { doAThing() }
4
jsii-rosetta
aws
Go
type iThing interface { thingArn() *string }
4
jsii-rosetta
aws
Go
callFunction(jsii.Boolean(true), jsii.Boolean(false))
2
jsii-rosetta
aws
Go
if x == 3 { fmt.Println("hello") }
4
jsii-rosetta
aws
Go
var variable Type
2
jsii-rosetta
aws
Go
if x == 3 {}
2
jsii-rosetta
aws
Go
for _, x := range xs { fmt.Println(x) }
4
jsii-rosetta
aws
Go
if x == 3 { fmt.Println("bye") }
4
jsii-rosetta
aws
Go
if x == 3 { fmt.Println("bye") } else { fmt.Println("toodels") }
6
jsii-rosetta
aws
Go
expected := map[string]interface{}{ "Foo": jsii.String("Bar"), "Baz": jsii.Number(5), "Qux": []*string{ jsii.String("Waldo"), jsii.String("Fred"), }, }
9
jsii-rosetta
aws
Go
if x == 3 { x += 1 fmt.Println("bye") } else { fmt.Println("toodels") }
7
jsii-rosetta
aws
Go
func doThing() *f64 { x := 1 // x seems to be equal to 1 return jsii.Number(x + 1) } func doThing2(x *f64) *bool { if *x == 1 { return jsii.Boolean(true) } return jsii.Boolean(false) } func doThing3() *f64 { x := 1 return jsii.Number(x + 1) } func doThing4() { x := 1 x = 85 }
22
jsii-rosetta
aws
Go
func test(..._args interface{}) { } test(map[string]interface{}{ "Key": jsii.String("Value"), "also": jsii.Number(1337), }) test(map[string]*string{ "Key": jsii.String("Value"), }, map[string]*f64{ "also": jsii.Number(1337), })
14
jsii-rosetta
aws
Go
statementOne() statementTwo()
4
jsii-rosetta
aws
Go
if condition { statementOne() statementTwo() }
6
jsii-rosetta
aws
Go
functionThatTakesAnAny(map[string]*f64{ "argument": jsii.Number(5), })
4
jsii-rosetta
aws
Go
takes(&myProps{ Struct: &someStruct{ Enabled: jsii.Boolean(false), Option: jsii.String("option"), }, })
9
jsii-rosetta
aws
Go
NewVpc(this, jsii.String("Something"), &vpcProps{ Argument: jsii.Number(5), })
4
jsii-rosetta
aws
Go
NewIntegration(this, jsii.String("Something"), &integrationOptions{ Argument: jsii.Number(5), })
4
jsii-rosetta
aws
Go
vpc := NewVpc(this, jsii.String("Something"), &vpcProps{ Argument: jsii.Number(5), })
4
jsii-rosetta
aws
Go
vpc := NewVpc(this, jsii.String("Something"), map[string]*f64{ "argument": jsii.Number(5), })
4
jsii-runtime-go
aws
Go
package jsii import ( "fmt" "reflect" "github.com/aws/jsii-runtime-go/internal/kernel" ) // UnsafeCast converts the given interface value to the desired target interface // pointer. Panics if the from value is not a jsii proxy object, or if the to // value is not a pointer to an interface type. func UnsafeCast(fr...
60
jsii-runtime-go
aws
Go
package jsii import ( "reflect" "testing" "github.com/aws/jsii-runtime-go/internal/api" "github.com/aws/jsii-runtime-go/internal/kernel" ) type MockInterfaceABase interface { MockMethodABase(_ float64) } type mockABase struct { _ int // padding } func (m *mockABase) MockMethodABase(_ float64) {} type MockIn...
102
jsii-runtime-go
aws
Go
package jsii import ( "reflect" "github.com/aws/jsii-runtime-go/internal/api" "github.com/aws/jsii-runtime-go/runtime" ) // Deprecated: FQN represents a fully-qualified type name in the jsii type system. type FQN api.FQN // Deprecated: Member is a runtime descriptor for a class or interface member type Member in...
132
jsii-runtime-go
aws
Go
//go:build (go1.16 || go1.17) && !go1.18 // +build go1.16 go1.17 // +build !go1.18 package jsii import ( "fmt" "os" "github.com/aws/jsii-runtime-go/internal/compiler" "github.com/mattn/go-isatty" ) // / Emits a deprecation warning message when func init() { tty := isatty.IsTerminal(os.Stderr.Fd()) || isatty.Is...
38
jsii-runtime-go
aws
Go
// Package jsii provides utilities that user code can leverage to facilitate // working with libraries generated by the `jsii-pacmak` tool. This includes // type conversion helpers as well as utilities to manage the runtime process' // lifecycle. package jsii
6
jsii-runtime-go
aws
Go
package jsii import "time" type basicType interface { bool | string | float64 | time.Time } // Ptr returns a pointer to the provided value. func Ptr[T basicType](v T) *T { return &v } // PtrSlice returns a pointer to a slice of pointers to all of the provided values. func PtrSlice[T basicType](v ...T) *[]*T { sl...
66
jsii-runtime-go
aws
Go
package jsii import ( "testing" "time" "github.com/stretchr/testify/assert" ) func TestV(t *testing.T) { // Bool assert.Equal(t, true, *Ptr(true)) assert.Equal(t, false, *Ptr(false)) // Bools assert.Equal(t, []*bool{Bool(true), Bool(false), Bool(false), Bool(true)}, *PtrSlice(true, false, false, true)) // F...
80
jsii-runtime-go
aws
Go
package jsii import "github.com/aws/jsii-runtime-go/internal/kernel" // Close finalizes the runtime process, signalling the end of the execution to // the jsii kernel process, and waiting for graceful termination. The best // practice is to defer call thins at the beginning of the "main" function. func Close() { ker...
11
jsii-runtime-go
aws
Go
//go:build tools // +build tools // Package tools contains the necessary statements to ensure tool dependencies // are not "cleaned up" by "go mod tidy" despite being used... The "// +" // comment above makes sure the file is never included in an actual compiled // unit (unless someone manually specifies the "build to...
16
jsii-runtime-go
aws
Go
package api import ( "fmt" "regexp" ) // FQN represents a fully-qualified type name in the jsii type system. type FQN string // Override is a public interface implementing a private method `isOverride` // implemented by the private custom type `override`. This is embedded by // MethodOverride and PropertyOverride ...
102
jsii-runtime-go
aws
Go
// Package api contains shared type definisions used by several modules part of // the jsii runtime for go. It helps avoid creating circular dependencies // between the other modules. package api
5
jsii-runtime-go
aws
Go
//go:build go1.16 && !go1.17 // +build go1.16,!go1.17 package compiler // Version denotes the version of the go compiler that was used for building // this binary. It is intended for use only in the compiler deprecation warning // message. const Version = "go1.16" // EndOfLifeDate is the date at which this compiler ...
13
jsii-runtime-go
aws
Go
//go:build go1.17 && !go1.18 // +build go1.17,!go1.18 package compiler // Version denotes the version of the go compiler that was used for building // this binary. It is intended for use only in the compiler deprecation warning // message. const Version = "go1.17" // EndOfLifeDate is the date at which this compiler ...
13
jsii-runtime-go
aws
Go
// Package embedded contains the embedded @jsii/kernel code, which is used // unless the JSII_RUNTIME environment variable is set to a different program. package embedded
4
jsii-runtime-go
aws
Go
package embedded import ( "embed" "os" "path" ) // embeddedRootDir is the name of the root directory for the embeddedFS variable. const embeddedRootDir string = "resources" //go:embed resources/* var embeddedFS embed.FS // entrypointName is the path to the entry point relative to the embeddedRootDir. var entrypo...
58
jsii-runtime-go
aws
Go
package embedded import ( "path" "testing" ) func TestEntryPointExists(t *testing.T) { if bytes, err := embeddedFS.ReadFile(path.Join(embeddedRootDir, entrypointName)); err != nil { t.Errorf("unable to read entry point data: %v", err) } else if len(bytes) == 0 { t.Error("entry point file is empty") } }
16
jsii-runtime-go
aws
Go
package kernel import ( "github.com/aws/jsii-runtime-go/internal/api" ) type BeginProps struct { Method *string `json:"method"` Arguments []interface{} `json:"args"` ObjRef api.ObjectRef `json:"objref"` } type BeginResponse struct { kernelResponse PromiseID *string `json:"promise_id"` } func (c *C...
26
jsii-runtime-go
aws
Go
package kernel import ( "fmt" "reflect" "strings" "github.com/aws/jsii-runtime-go/internal/api" ) type callback struct { CallbackID string `json:"cbid"` Cookie string `json:"cookie"` Invoke *invokeCallback `json:"invoke"` Get *getCallback `json:"get"` Set *setCallb...
258
jsii-runtime-go
aws
Go
package kernel import ( "fmt" "reflect" "runtime" "sync" "github.com/aws/jsii-runtime-go/internal/api" "github.com/aws/jsii-runtime-go/internal/kernel/process" "github.com/aws/jsii-runtime-go/internal/objectstore" "github.com/aws/jsii-runtime-go/internal/typeregistry" ) var ( clientInstance *Client cl...
143
jsii-runtime-go
aws
Go
package kernel import ( "reflect" "testing" "github.com/aws/jsii-runtime-go/internal/typeregistry" ) func TestClient(t *testing.T) { client, err := newClient() if err != nil { t.Fatalf("client init failed: %v", err.Error()) } defer client.close() t.Run("Client Load Error", func(t *testing.T) { request :...
63
jsii-runtime-go
aws
Go
package kernel type CompleteProps struct { CallbackID *string `json:"cbid"` Error *string `json:"err"` Result interface{} `json:"result"` } type CompleteResponse struct { kernelResponse CallbackID *string `json:"cbid"` } func (c *Client) Complete(props CompleteProps) (response CompleteResponse,...
22
jsii-runtime-go
aws
Go
package kernel import ( "fmt" "reflect" "time" "github.com/aws/jsii-runtime-go/internal/api" ) var ( anyType = reflect.TypeOf((*interface{})(nil)).Elem() ) // CastAndSetToPtr accepts a pointer to any type and attempts to cast the value // argument to be the same type. Then it sets the value of the pointer elem...
371
jsii-runtime-go
aws
Go
package kernel import "github.com/aws/jsii-runtime-go/internal/api" type CreateProps struct { FQN api.FQN `json:"fqn"` Interfaces []api.FQN `json:"interfaces,omitempty"` Arguments []interface{} `json:"args,omitempty"` Overrides []api.Override `json:"overrides,omitempty"` } // TODO extends A...
33
jsii-runtime-go
aws
Go
package kernel import "github.com/aws/jsii-runtime-go/internal/api" type DelProps struct { ObjRef api.ObjectRef `json:"objref"` } type DelResponse struct { kernelResponse } func (c *Client) Del(props DelProps) (response DelResponse, err error) { type request struct { kernelRequest DelProps } err = c.reques...
21
jsii-runtime-go
aws
Go
// Package kernel defines the interface for go programs to interact with the // @jsii/kernel node process. This module completely abstracts managament of the // child process. package kernel
5
jsii-runtime-go
aws
Go
package kernel type EndProps struct { PromiseID *string `json:"promise_id"` } type EndResponse struct { kernelResponse Result interface{} `json:"result"` } func (c *Client) End(props EndProps) (response EndResponse, err error) { type request struct { kernelRequest EndProps } err = c.request(request{kernelR...
20
jsii-runtime-go
aws
Go
package kernel import "github.com/aws/jsii-runtime-go/internal/api" type GetProps struct { Property string `json:"property"` ObjRef api.ObjectRef `json:"objref"` } type StaticGetProps struct { FQN api.FQN `json:"fqn"` Property string `json:"property"` } type GetResponse struct { kernelResponse ...
44
jsii-runtime-go
aws
Go
package kernel import "github.com/aws/jsii-runtime-go/internal/api" type InvokeProps struct { Method string `json:"method"` Arguments []interface{} `json:"args"` ObjRef api.ObjectRef `json:"objref"` } type StaticInvokeProps struct { FQN api.FQN `json:"fqn"` Method string `json...
46
jsii-runtime-go
aws
Go
package kernel import ( "encoding/json" "errors" ) // unmarshalKernelResponse performs custom unmarshaling for kernel responses, checks for presence of `error` key on json // and returns if present. // // The uresult parameter may be passed to json.Unmarshal so if unmarshalKernelResponse is called within a custom /...
41
jsii-runtime-go
aws
Go
package kernel import ( "fmt" "io/ioutil" "os" "regexp" ) // LoadProps holds the necessary information to load a library into the // @jsii/kernel process through the Load method. type LoadProps struct { Name string `json:"name"` Version string `json:"version"` } // LoadResponse contains the data returned by...
67
jsii-runtime-go
aws
Go
package kernel import ( "fmt" "reflect" "strings" "github.com/aws/jsii-runtime-go/internal/api" ) const objectFQN = "Object" func (c *Client) ManageObject(v reflect.Value) (ref api.ObjectRef, err error) { // Ensuring we use a pointer, so we can see pointer-receiver methods, too. var vt reflect.Type if v.Kind...
92
jsii-runtime-go
aws
Go
package kernel type NamingProps struct { Assembly string `json:"assembly"` } type NamingResponse struct { kernelResponse // readonly naming: { // readonly [language: string]: { readonly [key: string]: any } | undefined; // }; } func (c *Client) Naming(props NamingProps) (response NamingResponse, err error) { ...
22
jsii-runtime-go
aws
Go
package kernel // kernelRequester allows creating a union of kernelRequester and kernelResponder // types by defining private method implemented by a private custom type, which // is embedded in all relevant types. type kernelRequester interface { // isRequest is a marker method that is intended to ensure no external...
41
jsii-runtime-go
aws
Go
package kernel import "github.com/aws/jsii-runtime-go/internal/api" type SetProps struct { Property string `json:"property"` Value interface{} `json:"value"` ObjRef api.ObjectRef `json:"objref"` } type StaticSetProps struct { FQN api.FQN `json:"fqn"` Property string `json:"property"`...
45
jsii-runtime-go
aws
Go
package kernel type StatsResponse struct { kernelResponse ObjectCount float64 `json:"object_count"` } func (c *Client) Stats() (response StatsResponse, err error) { err = c.request(kernelRequest{"stats"}, &response) return }
12
jsii-runtime-go
aws
Go
package kernel const version = "1.84.0"
4
jsii-runtime-go
aws
Go
package process import ( "bufio" "encoding/json" "io" "os" ) type consoleMessage struct { Stderr []byte `json:"stderr"` Stdout []byte `json:"stdout"` } // consumeStderr is intended to be used as a goroutine, and will consume this // process' stderr stream until it reaches EOF. It reads the stream line-by-line ...
43
jsii-runtime-go
aws
Go
package process import ( "fmt" "regexp" "github.com/Masterminds/semver/v3" ) type handshakeResponse struct { Hello string `json:"hello"` } func (h *handshakeResponse) runtimeVersion() (*semver.Version, error) { re := regexp.MustCompile("@") parts := re.Split(h.Hello, 3) switch len(parts) { case 2: return ...
26
jsii-runtime-go
aws
Go
package process import ( "encoding/json" "errors" "fmt" "io" "io/ioutil" "os" "os/exec" "runtime" "strings" "sync" "github.com/Masterminds/semver/v3" "github.com/aws/jsii-runtime-go/internal/embedded" ) const JSII_NODE string = "JSII_NODE" const JSII_RUNTIME string = "JSII_RUNTIME" type ErrorResponse st...
301
jsii-runtime-go
aws
Go
package process import ( _ "embed" "fmt" "io/ioutil" "os" "os/exec" "runtime" "strings" "testing" ) //go:embed jsii-mock-runtime.js var mockRuntimeSource []byte var mockRuntime string func TestMain(m *testing.M) { file, _ := ioutil.TempFile("", "jsii-mock-runtime.*.js") if _, err := file.Write(mockRuntimeS...
188
jsii-runtime-go
aws
Go
// Package objectstore implements support for tracking a mapping of object // references to and from their instance ID. It tracks objects by proxy of their // memory address (i.e: pointer value), in order to avoid the pitfalls of go's // standard object equality mechanism (which is also reflect.Value's equality // mech...
8
jsii-runtime-go
aws
Go
package objectstore import ( "fmt" "reflect" "github.com/aws/jsii-runtime-go/internal/api" ) // stringSet is a set of strings, implemented as a map from string to an // arbitrary 0-width value. type stringSet map[string]struct{} // ObjectStore tracks object instances for which an identifier has been // associate...
266
jsii-runtime-go
aws
Go
package typeregistry import ( "reflect" "strings" "github.com/aws/jsii-runtime-go/internal/api" ) // DiscoverImplementation determines the list of registered interfaces that are // implemented by the provided type, and returns the list of their FQNs and // overrides for all their combined methods and properties. ...
72
jsii-runtime-go
aws
Go
// Package typeregistry offers features useful to manage the registration and // operation of types in the context of the jsii runtime. These are used to // support type conversion for values exchanged between the child node process // and the go application. package typeregistry
6
jsii-runtime-go
aws
Go
package typeregistry import ( "github.com/aws/jsii-runtime-go/internal/api" ) func (t *TypeRegistry) GetOverride(fqn api.FQN, n string) (api.Override, bool) { if members, ok := t.typeMembers[fqn]; ok { for _, member := range members { if member.GoName() == n { return member, true } } } return nil, ...
18
jsii-runtime-go
aws
Go
package typeregistry import ( "fmt" "reflect" "github.com/aws/jsii-runtime-go/internal/api" ) type typeKind uint8 const ( _ = iota classType typeKind = iota enumType typeKind = iota interfaceType typeKind = iota structType typeKind = iota ) type registeredType struct { Typ...
171
jsii-runtime-go
aws
Go
package typeregistry import ( "fmt" "reflect" "github.com/aws/jsii-runtime-go/internal/api" ) // TypeRegistry is used to record runtime type information about the loaded // modules, which is later used to correctly convert objects received from the // JavaScript process into native go values. type TypeRegistry st...
176
jsii-runtime-go
aws
Go
package typeregistry import ( "fmt" "reflect" ) // ValidateStruct runs validations on the supplied struct to determine whether // it is valid. In particular, it checks union-typed properties to ensure the // provided value is of one of the allowed types. // // May panic if v is not a pointer to a struct value. func...
28
jsii-runtime-go
aws
Go
// Package runtime provides the APIs used by code generated by the `jsii-pacmak` // tool to interact with the `@jsii/kernel` process. It is not intended for // users to directly interact with, and doing so could result in incorrect // behavior. package runtime
6
jsii-runtime-go
aws
Go
package runtime import ( "reflect" "sort" "testing" ) type IFace interface { M1() M2() M3() } type Base struct { X, Y int } func (b *Base) M1() {} func (b *Base) M2() {} func (b *Base) M3() {} type D1 struct { *Base } func (d *D1) M1() {} func (d *D1) X1() {} type D2 struct { Name string IFace } func...
66
jsii-runtime-go
aws
Go
package runtime import ( "fmt" "reflect" "strings" "github.com/aws/jsii-runtime-go/internal/api" "github.com/aws/jsii-runtime-go/internal/kernel" ) // FQN represents a fully-qualified type name in the jsii type system. type FQN api.FQN // Member is a runtime descriptor for a class or interface member type Memb...
445
jsii-runtime-go
aws
Go
package runtime import "github.com/aws/jsii-runtime-go/internal/kernel" // ValidateStruct runs validations on the supplied struct to determine whether // it is valid. In particular, it checks union-typed properties to ensure the // provided value is of one of the allowed types. func ValidateStruct(v interface{}, d fu...
12
karpenter
aws
Go
/* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License i...
72
karpenter
aws
Go
/* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License i...
148
karpenter
aws
Go
/* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License i...
205
karpenter
aws
Go
/* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License i...
165