Skip to content

misc: more stdlib stubs to allow compilation #4916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/reflect/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,3 +529,7 @@ func FuncOf(in, out []Type, variadic bool) Type {

return toType(reflectlite.FuncOf(rawIn, rawOut, variadic))
}

func ChanOf(dir ChanDir, t Type) Type {
panic("unimplemented: reflect.ChanOf")
}
8 changes: 8 additions & 0 deletions src/reflect/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ func (v Value) Send(x Value) {
panic("unimplemented: reflect.Value.Send()")
}

func (v Value) TrySend(x Value) bool {
panic("unimplemented: reflect.Value.TrySend()")
}

func (v Value) Close() {
panic("unimplemented: reflect.Value.Close()")
}
Expand Down Expand Up @@ -217,6 +221,10 @@ func (v Value) Recv() (x Value, ok bool) {
panic("unimplemented: (reflect.Value).Recv()")
}

func (v Value) TryRecv() (x Value, ok bool) {
panic("unimplemented: (reflect.Value).TryRecv()")
}

func NewAt(typ Type, p unsafe.Pointer) Value {
panic("unimplemented: reflect.New()")
}
Expand Down
37 changes: 37 additions & 0 deletions src/runtime/debug/garbage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Package debug is a very partially implemented package to allow compilation.
package debug

import (
"time"
)

type GCStats struct {
LastGC time.Time
NumGC int64
PauseTotal time.Duration
Pause []time.Duration
PauseEnd []time.Time
PauseQuantiles []time.Duration
}

func ReadGCStats(stats *GCStats) {
}

func FreeOSMemory() {
}

func SetMaxThreads(threads int) int {
return threads
}

func SetPanicOnFault(enabled bool) bool {
return enabled
}

func WriteHeapDump(fd uintptr)

func SetTraceback(level string)

func SetMemoryLimit(limit int64) int64 {
return limit
}
28 changes: 23 additions & 5 deletions src/runtime/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,26 @@

package metrics

type Description struct{}
type Description struct {
Name string
Description string
Kind ValueKind
Cumulative bool
}

func All() []Description {
return nil
}

type Float64Histogram struct{}
type Float64Histogram struct {
Counts []uint64
Buckets []float64
}

type Sample struct{}
type Sample struct {
Name string
Value Value
}

func Read(m []Sample) {}

Expand All @@ -23,10 +34,17 @@ func (v Value) Float64Histogram() *Float64Histogram {
return nil
}
func (v Value) Kind() ValueKind {
return ValueKind{}
return KindBad
}
func (v Value) Uint64() uint64 {
return 0
}

type ValueKind struct{}
type ValueKind int

const (
KindBad ValueKind = iota
KindUint64
KindFloat64
KindFloat64Histogram
)