mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-08 21:13:39 +00:00
all: drop support for Go 1.16 and Go 1.17
This commit is contained in:
committed by
Ron Evans
parent
f094e895c5
commit
4695da83b7
@@ -1,2 +0,0 @@
|
||||
internal/itoa is new to go as of 1.17.
|
||||
This directory should be removed when tinygo drops support for go 1.16.
|
||||
@@ -1,33 +0,0 @@
|
||||
// Copyright 2021 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Simple conversions to avoid depending on strconv.
|
||||
|
||||
package itoa
|
||||
|
||||
// Itoa converts val to a decimal string.
|
||||
func Itoa(val int) string {
|
||||
if val < 0 {
|
||||
return "-" + Uitoa(uint(-val))
|
||||
}
|
||||
return Uitoa(uint(val))
|
||||
}
|
||||
|
||||
// Uitoa converts val to a decimal string.
|
||||
func Uitoa(val uint) string {
|
||||
if val == 0 { // avoid string allocation
|
||||
return "0"
|
||||
}
|
||||
var buf [20]byte // big enough for 64bit value base 10
|
||||
i := len(buf) - 1
|
||||
for val >= 10 {
|
||||
q := val / 10
|
||||
buf[i] = byte('0' + val - q*10)
|
||||
i--
|
||||
val = q
|
||||
}
|
||||
// val < 10
|
||||
buf[i] = byte('0' + val)
|
||||
return string(buf[i:])
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
// Copyright 2021 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package itoa_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"internal/itoa"
|
||||
"math"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var (
|
||||
minInt64 int64 = math.MinInt64
|
||||
maxInt64 int64 = math.MaxInt64
|
||||
maxUint64 uint64 = math.MaxUint64
|
||||
)
|
||||
|
||||
func TestItoa(t *testing.T) {
|
||||
tests := []int{int(minInt64), math.MinInt32, -999, -100, -1, 0, 1, 100, 999, math.MaxInt32, int(maxInt64)}
|
||||
for _, tt := range tests {
|
||||
got := itoa.Itoa(tt)
|
||||
want := fmt.Sprint(tt)
|
||||
if want != got {
|
||||
t.Fatalf("Itoa(%d) = %s, want %s", tt, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestUitoa(t *testing.T) {
|
||||
tests := []uint{0, 1, 100, 999, math.MaxUint32, uint(maxUint64)}
|
||||
for _, tt := range tests {
|
||||
got := itoa.Uitoa(tt)
|
||||
want := fmt.Sprint(tt)
|
||||
if want != got {
|
||||
t.Fatalf("Uitoa(%d) = %s, want %s", tt, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,3 @@
|
||||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Portions copyright 2009 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
@@ -1,36 +0,0 @@
|
||||
//go:build !go1.18
|
||||
// +build !go1.18
|
||||
|
||||
// Portions copyright 2009 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package runtime
|
||||
|
||||
type puintptr uintptr
|
||||
|
||||
// Package time knows the layout of this structure.
|
||||
// If this struct changes, adjust ../time/sleep.go:/runtimeTimer.
|
||||
type timer struct {
|
||||
// If this timer is on a heap, which P's heap it is on.
|
||||
// puintptr rather than *p to match uintptr in the versions
|
||||
// of this struct defined in other packages.
|
||||
pp puintptr
|
||||
|
||||
// Timer wakes up at when, and then at when+period, ... (period > 0 only)
|
||||
// each time calling f(arg, now) in the timer goroutine, so f must be
|
||||
// a well-behaved function and not block.
|
||||
//
|
||||
// when must be positive on an active timer.
|
||||
when int64
|
||||
period int64
|
||||
f func(interface{}, uintptr)
|
||||
arg interface{}
|
||||
seq uintptr
|
||||
|
||||
// What to set the when field to in timerModifiedXX status.
|
||||
nextwhen int64
|
||||
|
||||
// The status field holds one of the values below.
|
||||
status uint32
|
||||
}
|
||||
@@ -511,3 +511,15 @@ type InternalExample struct {
|
||||
Output string
|
||||
Unordered bool
|
||||
}
|
||||
|
||||
// MainStart is meant for use by tests generated by 'go test'.
|
||||
// It is not meant to be called directly and is not subject to the Go 1 compatibility document.
|
||||
// It may change signature from release to release.
|
||||
func MainStart(deps interface{}, tests []InternalTest, benchmarks []InternalBenchmark, fuzzTargets []InternalFuzzTarget, examples []InternalExample) *M {
|
||||
Init()
|
||||
return &M{
|
||||
Tests: tests,
|
||||
Benchmarks: benchmarks,
|
||||
deps: deps.(testDeps),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
package testing
|
||||
|
||||
// MainStart is meant for use by tests generated by 'go test'.
|
||||
// It is not meant to be called directly and is not subject to the Go 1 compatibility document.
|
||||
// It may change signature from release to release.
|
||||
func MainStart(deps interface{}, tests []InternalTest, benchmarks []InternalBenchmark, fuzzTargets []InternalFuzzTarget, examples []InternalExample) *M {
|
||||
Init()
|
||||
return &M{
|
||||
Tests: tests,
|
||||
Benchmarks: benchmarks,
|
||||
deps: deps.(testDeps),
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
//go:build !go1.18
|
||||
// +build !go1.18
|
||||
|
||||
package testing
|
||||
|
||||
// MainStart is meant for use by tests generated by 'go test'.
|
||||
// It is not meant to be called directly and is not subject to the Go 1 compatibility document.
|
||||
// It may change signature from release to release.
|
||||
func MainStart(deps interface{}, tests []InternalTest, benchmarks []InternalBenchmark, examples []InternalExample) *M {
|
||||
Init()
|
||||
return &M{
|
||||
Tests: tests,
|
||||
Benchmarks: benchmarks,
|
||||
deps: deps.(testDeps),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user