Skip to content

Commit f113760

Browse files
committed
Rerun gofumpt with a modern version, to adapt the 1.19 GoDoc changes
1 parent 714862f commit f113760

File tree

9 files changed

+70
-65
lines changed

9 files changed

+70
-65
lines changed

build/build.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ func NewBuildContext(installSuffix string, buildTags []string) XContext {
7272
// In the directory containing the package, .go and .inc.js files are
7373
// considered part of the package except for:
7474
//
75-
// - .go files in package documentation
76-
// - files starting with _ or . (likely editor temporary files)
77-
// - files with build constraints not satisfied by the context
75+
// - .go files in package documentation
76+
// - files starting with _ or . (likely editor temporary files)
77+
// - files with build constraints not satisfied by the context
7878
//
7979
// If an error occurs, Import returns a non-nil error and a nil
8080
// *PackageData.

compiler/linkname.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ type GoLinkname struct {
2626
// This is a logical equivalent of a symbol name used by traditional linkers.
2727
// The following properties should hold true:
2828
//
29-
// - Each named symbol within a program has a unique SymName.
30-
// - Similarly named methods of different types will have different symbol names.
31-
// - The string representation is opaque and should not be attempted to reversed
32-
// to a struct form.
29+
// - Each named symbol within a program has a unique SymName.
30+
// - Similarly named methods of different types will have different symbol names.
31+
// - The string representation is opaque and should not be attempted to reversed
32+
// to a struct form.
3333
type SymName struct {
3434
PkgPath string // Full package import path.
3535
Name string // Symbol name.
@@ -85,12 +85,12 @@ func (n SymName) IsMethod() (recv string, method string, ok bool) {
8585
//
8686
// GopherJS directive support has the following limitations:
8787
//
88-
// - External linkname must be specified.
89-
// - The directive must be applied to a package-level function or method (variables
90-
// are not supported).
91-
// - The local function referenced by the directive must have no body (in other
92-
// words, it can only "import" an external function implementation into the
93-
// local scope).
88+
// - External linkname must be specified.
89+
// - The directive must be applied to a package-level function or method (variables
90+
// are not supported).
91+
// - The local function referenced by the directive must have no body (in other
92+
// words, it can only "import" an external function implementation into the
93+
// local scope).
9494
func parseGoLinknames(fset *token.FileSet, pkgPath string, file *ast.File) ([]GoLinkname, error) {
9595
var errs ErrorList = nil
9696
var directives []GoLinkname

compiler/natives/src/math/big/big.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
package big
55

66
// TODO: This is a workaround for https://github.com/gopherjs/gopherjs/issues/652.
7-
// Remove after that issue is resolved.
7+
//
8+
// Remove after that issue is resolved.
89
type Word uintptr

compiler/utils.go

+26-22
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,18 @@ func (fc *funcContext) Delayed(f func()) {
8484
// tuple elements.
8585
//
8686
// For example, for functions defined as:
87-
// func a() (int, string) {return 42, "foo"}
88-
// func b(a1 int, a2 string) {}
87+
//
88+
// func a() (int, string) {return 42, "foo"}
89+
// func b(a1 int, a2 string) {}
90+
//
8991
// ...the following statement:
90-
// b(a())
92+
//
93+
// b(a())
94+
//
9195
// ...will be transformed into:
92-
// _tuple := a()
93-
// b(_tuple[0], _tuple[1])
96+
//
97+
// _tuple := a()
98+
// b(_tuple[0], _tuple[1])
9499
func (fc *funcContext) expandTupleArgs(argExprs []ast.Expr) []ast.Expr {
95100
if len(argExprs) != 1 {
96101
return argExprs
@@ -513,24 +518,24 @@ func isBlank(expr ast.Expr) bool {
513518
//
514519
// For example, consider a Go type:
515520
//
516-
// type SecretInt int
517-
// func (_ SecretInt) String() string { return "<secret>" }
521+
// type SecretInt int
522+
// func (_ SecretInt) String() string { return "<secret>" }
518523
//
519-
// func main() {
520-
// var i SecretInt = 1
521-
// println(i.String())
522-
// }
524+
// func main() {
525+
// var i SecretInt = 1
526+
// println(i.String())
527+
// }
523528
//
524529
// For this example the compiler will generate code similar to the snippet below:
525530
//
526-
// SecretInt = $pkg.SecretInt = $newType(4, $kindInt, "main.SecretInt", true, "main", true, null);
527-
// SecretInt.prototype.String = function() {
528-
// return "<secret>";
529-
// };
530-
// main = function() {
531-
// var i = 1;
532-
// console.log(new SecretInt(i).String());
533-
// };
531+
// SecretInt = $pkg.SecretInt = $newType(4, $kindInt, "main.SecretInt", true, "main", true, null);
532+
// SecretInt.prototype.String = function() {
533+
// return "<secret>";
534+
// };
535+
// main = function() {
536+
// var i = 1;
537+
// console.log(new SecretInt(i).String());
538+
// };
534539
//
535540
// Note that the generated code assigns a primitive "number" value into i, and
536541
// only boxes it into an object when it's necessary to access its methods.
@@ -699,13 +704,12 @@ func encodeIdent(name string) string {
699704
//
700705
// For example:
701706
//
702-
// "my_name" -> ".my_name"
703-
// "my name" -> `["my name"]`
707+
// "my_name" -> ".my_name"
708+
// "my name" -> `["my name"]`
704709
//
705710
// For more information about JavaScript property accessors and identifiers, see
706711
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors and
707712
// https://developer.mozilla.org/en-US/docs/Glossary/Identifier.
708-
//
709713
func formatJSStructTagVal(jsTag string) string {
710714
for i, r := range jsTag {
711715
ok := unicode.IsLetter(r) || (i != 0 && unicode.IsNumber(r)) || r == '$' || r == '_'

js/js.go

+19-19
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22
//
33
// Use MakeWrapper to expose methods to JavaScript. Use MakeFullWrapper to expose methods AND fields to JavaScript. When passing values directly, the following type conversions are performed:
44
//
5-
// | Go type | JavaScript type | Conversions back to interface{} |
6-
// | --------------------- | --------------------- | ------------------------------- |
7-
// | bool | Boolean | bool |
8-
// | integers and floats | Number | float64 |
9-
// | string | String | string |
10-
// | []int8 | Int8Array | []int8 |
11-
// | []int16 | Int16Array | []int16 |
12-
// | []int32, []int | Int32Array | []int |
13-
// | []uint8 | Uint8Array | []uint8 |
14-
// | []uint16 | Uint16Array | []uint16 |
15-
// | []uint32, []uint | Uint32Array | []uint |
16-
// | []float32 | Float32Array | []float32 |
17-
// | []float64 | Float64Array | []float64 |
18-
// | all other slices | Array | []interface{} |
19-
// | arrays | see slice type | see slice type |
20-
// | functions | Function | func(...interface{}) *js.Object |
21-
// | time.Time | Date | time.Time |
22-
// | - | instanceof Node | *js.Object |
23-
// | maps, structs | instanceof Object | map[string]interface{} |
5+
// | Go type | JavaScript type | Conversions back to interface{} |
6+
// | --------------------- | --------------------- | ------------------------------- |
7+
// | bool | Boolean | bool |
8+
// | integers and floats | Number | float64 |
9+
// | string | String | string |
10+
// | []int8 | Int8Array | []int8 |
11+
// | []int16 | Int16Array | []int16 |
12+
// | []int32, []int | Int32Array | []int |
13+
// | []uint8 | Uint8Array | []uint8 |
14+
// | []uint16 | Uint16Array | []uint16 |
15+
// | []uint32, []uint | Uint32Array | []uint |
16+
// | []float32 | Float32Array | []float32 |
17+
// | []float64 | Float64Array | []float64 |
18+
// | all other slices | Array | []interface{} |
19+
// | arrays | see slice type | see slice type |
20+
// | functions | Function | func(...interface{}) *js.Object |
21+
// | time.Time | Date | time.Time |
22+
// | - | instanceof Node | *js.Object |
23+
// | maps, structs | instanceof Object | map[string]interface{} |
2424
//
2525
// Additionally, for a struct containing a *js.Object field, only the content of the field will be passed to JavaScript and vice versa.
2626
package js

nosync/once.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,23 @@ type Once struct {
88

99
// Do calls the function f if and only if Do is being called for the
1010
// first time for this instance of Once. In other words, given
11-
// var once Once
11+
//
12+
// var once Once
13+
//
1214
// if once.Do(f) is called multiple times, only the first call will invoke f,
1315
// even if f has a different value in each invocation. A new instance of
1416
// Once is required for each function to execute.
1517
//
1618
// Do is intended for initialization that must be run exactly once. Since f
1719
// is niladic, it may be necessary to use a function literal to capture the
1820
// arguments to a function to be invoked by Do:
19-
// config.once.Do(func() { config.init(filename) })
21+
//
22+
// config.once.Do(func() { config.init(filename) })
2023
//
2124
// If f causes Do to be called, it will panic.
2225
//
2326
// If f panics, Do considers it to have returned; future calls of Do return
2427
// without calling f.
25-
//
2628
func (o *Once) Do(f func()) {
2729
if o.done {
2830
return

nosync/pool.go

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ package nosync
2828
// not a suitable use for a Pool, since the overhead does not amortize well in
2929
// that scenario. It is more efficient to have such objects implement their own
3030
// free list.
31-
//
3231
type Pool struct {
3332
store []interface{}
3433
New func() interface{}

tests/gorepo/run.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//
1212
// To run manually with summary, verbose output, and full stack traces of of known failures:
1313
//
14-
// go run run.go -summary -v -show_known_fails
14+
// go run run.go -summary -v -show_known_fails
1515
//
1616
// TODO(bradfitz): docs of some sort, once we figure out how we're changing
1717
// headers of files
@@ -45,7 +45,6 @@ import (
4545
// GOPHERJS: Known test fails for GopherJS compiler.
4646
//
4747
// TODO: Reduce these to zero or as close as possible.
48-
//
4948
var knownFails = map[string]failReason{
5049
"fixedbugs/bug114.go": {desc: "fixedbugs/bug114.go:15:27: B32 (untyped int constant 4294967295) overflows int"},
5150
"fixedbugs/bug242.go": {desc: "bad map check 13 false false Error: fail"},

tests/runtime_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ func Test_parseCallFrame(t *testing.T) {
2323
want: "foo https://gopherjs.github.io/playground/playground.js 102 11836",
2424
},
2525
{
26-
name: "Chrome 96, anonymous eval",
26+
name: "Chrome 96, anonymous eval",
2727
input: " at eval (<anonymous>)",
28-
want: "eval <anonymous> 0 0",
28+
want: "eval <anonymous> 0 0",
2929
},
3030
{
31-
name: "Chrome 96, anonymous Array.forEach",
31+
name: "Chrome 96, anonymous Array.forEach",
3232
input: " at Array.forEach (<anonymous>)",
33-
want: "Array.forEach <anonymous> 0 0",
33+
want: "Array.forEach <anonymous> 0 0",
3434
},
3535
{
3636
name: "Chrome 96, file location only",

0 commit comments

Comments
 (0)