| 1 |
// Copyright 2022 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
package a |
| 6 |
|
| 7 |
import "unsafe" |
| 8 |
|
| 9 |
func Append() { |
| 10 |
_ = append(appendArgs()) |
| 11 |
} |
| 12 |
|
| 13 |
func Delete() { |
| 14 |
delete(deleteArgs()) |
| 15 |
} |
| 16 |
|
| 17 |
func Print() { |
| 18 |
print(ints()) |
| 19 |
} |
| 20 |
|
| 21 |
func Println() { |
| 22 |
println(ints()) |
| 23 |
} |
| 24 |
|
| 25 |
func Complex() { |
| 26 |
_ = complex(float64s()) |
| 27 |
} |
| 28 |
|
| 29 |
func Copy() { |
| 30 |
copy(slices()) |
| 31 |
} |
| 32 |
|
| 33 |
func UnsafeAdd() { |
| 34 |
_ = unsafe.Add(unsafeAdd()) |
| 35 |
} |
| 36 |
|
| 37 |
func UnsafeSlice() { |
| 38 |
_ = unsafe.Slice(unsafeSlice()) |
| 39 |
} |
| 40 |
|
| 41 |
func appendArgs() ([]int, int) { |
| 42 |
return []int{}, 0 |
| 43 |
} |
| 44 |
|
| 45 |
func deleteArgs() (map[int]int, int) { |
| 46 |
return map[int]int{}, 0 |
| 47 |
} |
| 48 |
|
| 49 |
func ints() (int, int) { |
| 50 |
return 1, 1 |
| 51 |
} |
| 52 |
|
| 53 |
func float64s() (float64, float64) { |
| 54 |
return 0, 0 |
| 55 |
} |
| 56 |
|
| 57 |
func slices() ([]int, []int) { |
| 58 |
return []int{}, []int{} |
| 59 |
} |
| 60 |
|
| 61 |
func unsafeAdd() (unsafe.Pointer, int) { |
| 62 |
return nil, 0 |
| 63 |
} |
| 64 |
|
| 65 |
func unsafeSlice() (*byte, int) { |
| 66 |
var p [10]byte |
| 67 |
return &p[0], 0 |
| 68 |
} |