diff --git a/.github/workflows/go.yml b/.github/workflows/gop.yml similarity index 62% rename from .github/workflows/go.yml rename to .github/workflows/gop.yml index 91bc8be..c08d1e3 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/gop.yml @@ -1,7 +1,7 @@ -# This workflow will build a golang project +# This workflow will build a goplus project # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go -name: Go +name: Go+ on: push: @@ -16,11 +16,12 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@v4 + - name: Set up Go/Go+ + uses: goplus/setup-goplus@v1 with: - go-version: '1.18' + go-version: "1.18" + gop-version: "1.1.8" - name: Build run: | - go build -v ./... + gop go -t -s ./... diff --git a/103-Constants/constants.gop b/103-Constants/constants.gop index 3d0847f..faafa88 100644 --- a/103-Constants/constants.gop +++ b/103-Constants/constants.gop @@ -1,30 +1,30 @@ -// Go+ supports _constants_ of character, string, boolean, -// and numeric values. - -import ( - "math" -) - -// `const` declares a constant value. -const s string = "constant" - -println s - -// A `const` statement can appear anywhere a `var` -// statement can. -const n = 500000000 - -// Constant expressions perform arithmetic with -// arbitrary precision. -const d = 3e20 / n -println d - -// A numeric constant has no type until it's given -// one, such as by an explicit conversion. -println int64(d) - -// A number can be given a type by using it in a -// context that requires one, such as a variable -// assignment or function call. For example, here -// `math.sin` expects a `float64`. -println math.sin(n) +// Go+ supports _constants_ of character, string, boolean, +// and numeric values. + +import ( + "math" +) + +// `const` declares a constant value. +const s string = "constant" + +println s + +// A `const` statement can appear anywhere a `var` +// statement can. +const n = 500000000 + +// Constant expressions perform arithmetic with +// arbitrary precision. +const d = 3e20 / n +println d + +// A numeric constant has no type until it's given +// one, such as by an explicit conversion. +println int64(d) + +// A number can be given a type by using it in a +// context that requires one, such as a variable +// assignment or function call. For example, here +// `math.sin` expects a `float64`. +println math.sin(n) diff --git a/104-Variables/vars.gop b/104-Variables/vars.gop index fbefc4f..4958e2a 100644 --- a/104-Variables/vars.gop +++ b/104-Variables/vars.gop @@ -1,27 +1,28 @@ -// In Go+, _variables_ are explicitly declared and used by -// the compiler to e.g. check type-correctness of function -// calls. - -// `var` declares 1 or more variables. -var a = "initial" -println a - -// You can declare multiple variables at once. -var b, c int = 1, 2 -println b, c - -// Go+ will infer the type of initialized variables. -var d = true -println d - -// Variables declared without a corresponding -// initialization are _zero-valued_. For example, the -// zero value for an `int` is `0`. -var e int -println e - -// The `:=` syntax is shorthand for declaring and -// initializing a variable, e.g. for -// `var f string = "apple"` in this case. -f := "apple" -println f +// In Go+, _variables_ are explicitly declared and used by +// the compiler to e.g. check type-correctness of function +// calls. + +// `var` declares 1 or more variables. +var a = "initial" + +println a + +// You can declare multiple variables at once. +var b, c int = 1, 2 +println b, c + +// Go+ will infer the type of initialized variables. +var d = true +println d + +// Variables declared without a corresponding +// initialization are _zero-valued_. For example, the +// zero value for an `int` is `0`. +var e int +println e + +// The `:=` syntax is shorthand for declaring and +// initializing a variable, e.g. for +// `var f string = "apple"` in this case. +f := "apple" +println f diff --git a/105-Assignments/assign.gop b/105-Assignments/assign.gop index e69de29..8b13789 100644 --- a/105-Assignments/assign.gop +++ b/105-Assignments/assign.gop @@ -0,0 +1 @@ + diff --git a/106-Types/types.gop b/106-Types/types.gop index e69de29..8b13789 100644 --- a/106-Types/types.gop +++ b/106-Types/types.gop @@ -0,0 +1 @@ + diff --git a/107-Integers/integers.gop b/107-Integers/integers.gop index e69de29..8b13789 100644 --- a/107-Integers/integers.gop +++ b/107-Integers/integers.gop @@ -0,0 +1 @@ + diff --git a/108-Floating-Point-Numbers/numbers.gop b/108-Floating-Point-Numbers/numbers.gop index e69de29..8b13789 100644 --- a/108-Floating-Point-Numbers/numbers.gop +++ b/108-Floating-Point-Numbers/numbers.gop @@ -0,0 +1 @@ + diff --git a/109-Complex-Numbers/complex.gop b/109-Complex-Numbers/complex.gop index e69de29..8b13789 100644 --- a/109-Complex-Numbers/complex.gop +++ b/109-Complex-Numbers/complex.gop @@ -0,0 +1 @@ + diff --git a/110-Booleans/boolean.gop b/110-Booleans/boolean.gop index e69de29..8b13789 100644 --- a/110-Booleans/boolean.gop +++ b/110-Booleans/boolean.gop @@ -0,0 +1 @@ + diff --git a/111-Strings/strings.gop b/111-Strings/strings.gop index 6e8dc44..9692fe4 100644 --- a/111-Strings/strings.gop +++ b/111-Strings/strings.gop @@ -1,51 +1,51 @@ -// A string is a sequence of bytes that cannot be changed. Strings can contain any data -// and are generally used to save text. -// -// We generally use double quotes "" to define a string, but note that there are specific -// characters that have a specific meaning, which we call escaped characters, and these -// escaped characters contain: -// -//
-//   \n:line break
-//   \r:Enter
-//   \t:Tab
-//   \u or \U:Unicode
-//   \:Backslash
-// 
- -println("hello" + "\t" + "world") // hello world - -// If we want to know the length of the strings taken up by bytes, we can use Go+'s built-in -// functions to calculate it: - -println(len("helloword")) // 9 - -// If we were to define a string, the grammar would be as follows: - -str := "helloword" -println(str) // helloword -println(len(str)) // 9 - -// We can stitch two strings together by +, appending the later string to the later of the -// earlier string. - -str1 := "hello" + "word" -println(str1) // helloword - -str2 := "my name is \t" -str3 := "zs" - -println(str2 + str3) // my name is zs - -// If we want to define a multi-line string, Go+ supports that too. Using the traditional -// "" is not possible across lines, we can use backquotes if we want to define a multi-line -// string: ` - -const str4 = `First line -Second line -Third line -` -println(str4) - -// The code between the backquotes is not recognized by the editor, but only as part of -// the string. +// A string is a sequence of bytes that cannot be changed. Strings can contain any data +// and are generally used to save text. +// +// We generally use double quotes "" to define a string, but note that there are specific +// characters that have a specific meaning, which we call escaped characters, and these +// escaped characters contain: +// +//
+//   \n:line break
+//   \r:Enter
+//   \t:Tab
+//   \u or \U:Unicode
+//   \:Backslash
+// 
+ +println("hello" + "\t" + "world") // hello world + +// If we want to know the length of the strings taken up by bytes, we can use Go+'s built-in +// functions to calculate it: + +println(len("helloword")) // 9 + +// If we were to define a string, the grammar would be as follows: + +str := "helloword" +println(str) // helloword +println(len(str)) // 9 + +// We can stitch two strings together by +, appending the later string to the later of the +// earlier string. + +str1 := "hello" + "word" +println(str1) // helloword + +str2 := "my name is \t" +str3 := "zs" + +println(str2 + str3) // my name is zs + +// If we want to define a multi-line string, Go+ supports that too. Using the traditional +// "" is not possible across lines, we can use backquotes if we want to define a multi-line +// string: ` + +const str4 = `First line +Second line +Third line +` +println(str4) + +// The code between the backquotes is not recognized by the editor, but only as part of +// the string. diff --git a/113-If/Else/if-else.gop b/113-If/Else/if-else.gop index dd0f3d8..3e3364c 100644 --- a/113-If/Else/if-else.gop +++ b/113-If/Else/if-else.gop @@ -1,28 +1,28 @@ -// Branching with `if` and `else` in Go+ is -// straight-forward. - -// Here's a basic example. -if 7%2 == 0 { - println "7 is even" -} else { - println "7 is odd" -} - -// You can have an `if` statement without an else. -if 8%4 == 0 { - println "8 is divisible by 4" -} - -// A statement can precede conditionals; any variables -// declared in this statement are available in all -// branches. -if num := 9; num < 0 { - println num, "is negative" -} else if num < 10 { - println num, "has 1 digit" -} else { - println num, "has multiple digits" -} - -// Note that you don't need parentheses around conditions -// in Go+, but that the braces are required. +// Branching with `if` and `else` in Go+ is +// straight-forward. + +// Here's a basic example. +if 7%2 == 0 { + println "7 is even" +} else { + println "7 is odd" +} + +// You can have an `if` statement without an else. +if 8%4 == 0 { + println "8 is divisible by 4" +} + +// A statement can precede conditionals; any variables +// declared in this statement are available in all +// branches. +if num := 9; num < 0 { + println num, "is negative" +} else if num < 10 { + println num, "has 1 digit" +} else { + println num, "has multiple digits" +} + +// Note that you don't need parentheses around conditions +// in Go+, but that the braces are required. diff --git a/113-Switch/switch-1.gop b/113-Switch/switch-1.gop index 3f9e418..e90c152 100644 --- a/113-Switch/switch-1.gop +++ b/113-Switch/switch-1.gop @@ -1,55 +1,55 @@ -// _Switch statements_ express conditionals across many -// branches. - -import ( - "time" -) - -// Here's a basic `switch`. -i := 2 -print "Write ", i, " as " -switch i { -case 1: - println "one" -case 2: - println "two" -case 3: - println "three" -} - -// You can use commas to separate multiple expressions -// in the same `case` statement. We use the optional -// `default` case in this example as well. -switch time.now().weekday() { -case time.Saturday, time.Sunday: - println "It's the weekend" -default: - println "It's a weekday" -} - -// `switch` without an expression is an alternate way -// to express if/else logic. Here we also show how the -// `case` expressions can be non-constants. -t := time.now() -switch { -case t.hour() < 12: - println "It's before noon" -default: - println "It's after noon" -} - -// The switch in Go+ defaults to a break at the end of each case. -// Use fallthrough to enforce the code for the subsequent cases. - -// `switch` with `fallthrough`: -score := 80 -switch { -case score < 50: - printf "%d < 50\n", score - fallthrough -case score < 100: - printf "%d < 100\n", score - fallthrough -case score < 200: - printf "%d < 200\n", score -} +// _Switch statements_ express conditionals across many +// branches. + +import ( + "time" +) + +// Here's a basic `switch`. +i := 2 +print "Write ", i, " as " +switch i { +case 1: + println "one" +case 2: + println "two" +case 3: + println "three" +} + +// You can use commas to separate multiple expressions +// in the same `case` statement. We use the optional +// `default` case in this example as well. +switch time.now().weekday() { +case time.Saturday, time.Sunday: + println "It's the weekend" +default: + println "It's a weekday" +} + +// `switch` without an expression is an alternate way +// to express if/else logic. Here we also show how the +// `case` expressions can be non-constants. +t := time.now() +switch { +case t.hour() < 12: + println "It's before noon" +default: + println "It's after noon" +} + +// The switch in Go+ defaults to a break at the end of each case. +// Use fallthrough to enforce the code for the subsequent cases. + +// `switch` with `fallthrough`: +score := 80 +switch { +case score < 50: + printf "%d < 50\n", score + fallthrough +case score < 100: + printf "%d < 100\n", score + fallthrough +case score < 200: + printf "%d < 200\n", score +} diff --git a/114-For/for.gop b/114-For/for.gop index f5b71ee..e5f0afb 100644 --- a/114-For/for.gop +++ b/114-For/for.gop @@ -1,31 +1,31 @@ -// `for` is Go+'s only looping construct. Here are -// some basic types of `for` loops. - -// The most basic type, with a single condition. -i := 1 -for i <= 3 { - println i - i = i + 1 -} - -// A classic initial/condition/after `for` loop. -for j := 7; j <= 9; j++ { - println j -} - -// `for` without a condition will loop repeatedly -// until you `break` out of the loop or `return` from -// the enclosing function. -for { - println "loop" - break -} - -// You can also `continue` to the next iteration of -// the loop. -for n := 0; n <= 5; n++ { - if n%2 == 0 { - continue - } - println n -} +// `for` is Go+'s only looping construct. Here are +// some basic types of `for` loops. + +// The most basic type, with a single condition. +i := 1 +for i <= 3 { + println i + i = i + 1 +} + +// A classic initial/condition/after `for` loop. +for j := 7; j <= 9; j++ { + println j +} + +// `for` without a condition will loop repeatedly +// until you `break` out of the loop or `return` from +// the enclosing function. +for { + println "loop" + break +} + +// You can also `continue` to the next iteration of +// the loop. +for n := 0; n <= 5; n++ { + if n%2 == 0 { + continue + } + println n +} diff --git a/116-Arrays/arrays1.gop b/116-Arrays/arrays1.gop index f5e5666..32517dc 100644 --- a/116-Arrays/arrays1.gop +++ b/116-Arrays/arrays1.gop @@ -8,6 +8,7 @@ // part of the array's type. By default an array is // zero-valued, which for `int`s means `0`s. var a [5]int + println "empty:", a // We can set a value at an index using the diff --git a/116-Arrays/arrays2.gop b/116-Arrays/arrays2.gop index 53d13ef..8b03f55 100644 --- a/116-Arrays/arrays2.gop +++ b/116-Arrays/arrays2.gop @@ -4,6 +4,7 @@ // compose types to build multi-dimensional data // structures. var twoD [2][3]int + for i := 0; i < 2; i++ { for j := 0; j < 3; j++ { twoD[i][j] = i + j diff --git a/117-Slices/slices-0.gop b/117-Slices/slices-0.gop index 5f86975..96fedbc 100644 --- a/117-Slices/slices-0.gop +++ b/117-Slices/slices-0.gop @@ -1,53 +1,53 @@ -// _Slices_ are a key data type in Go+, giving a more -// powerful interface to sequences than arrays. - -# Slice foundations - -// Unlike arrays, slices are typed only by the -// elements they contain (not the number of elements). -// To create an empty slice with non-zero length, use -// the builtin `make`. Here we make a slice of -// `string`s of length `3` (initially zero-valued). -s := make([]string, 3) -println "emp:", s - -// We can set and get just like with arrays. -s[0] = "a" -s[1] = "b" -s[2] = "c" -println "set:", s -println "get:", s[2] - -// `len` returns the length of the slice as expected. -println "len:", len(s) - -// In addition to these basic operations, slices -// support several more that make them richer than -// arrays. One is the builtin `append`, which -// returns a slice containing one or more new values. -// Note that we need to accept a return value from -// `append` as we may get a new slice value. -s = append(s, "d") -s = append(s, "e", "f") -println "apd:", s - -// Slices can also be `copy`'d. Here we create an -// empty slice `c` of the same length as `s` and copy -// into `c` from `s`. -c := make([]string, len(s)) -copy c, s -println "cpy:", c - -// Slices support a "slice" operator with the syntax -// `slice[low:high]`. For example, this gets a slice -// of the elements `s[2]`, `s[3]`, and `s[4]`. -l := s[2:5] -println "sl1:", l - -// This slices up to (but excluding) `s[5]`. -l = s[:5] -println "sl2:", l - -// And this slices up from (and including) `s[2]`. -l = s[2:] -println "sl3:", l +// _Slices_ are a key data type in Go+, giving a more +// powerful interface to sequences than arrays. + +# Slice foundations + +// Unlike arrays, slices are typed only by the +// elements they contain (not the number of elements). +// To create an empty slice with non-zero length, use +// the builtin `make`. Here we make a slice of +// `string`s of length `3` (initially zero-valued). +s := make([]string, 3) +println "emp:", s + +// We can set and get just like with arrays. +s[0] = "a" +s[1] = "b" +s[2] = "c" +println "set:", s +println "get:", s[2] + +// `len` returns the length of the slice as expected. +println "len:", len(s) + +// In addition to these basic operations, slices +// support several more that make them richer than +// arrays. One is the builtin `append`, which +// returns a slice containing one or more new values. +// Note that we need to accept a return value from +// `append` as we may get a new slice value. +s = append(s, "d") +s = append(s, "e", "f") +println "apd:", s + +// Slices can also be `copy`'d. Here we create an +// empty slice `c` of the same length as `s` and copy +// into `c` from `s`. +c := make([]string, len(s)) +copy c, s +println "cpy:", c + +// Slices support a "slice" operator with the syntax +// `slice[low:high]`. For example, this gets a slice +// of the elements `s[2]`, `s[3]`, and `s[4]`. +l := s[2:5] +println "sl1:", l + +// This slices up to (but excluding) `s[5]`. +l = s[:5] +println "sl2:", l + +// And this slices up from (and including) `s[2]`. +l = s[2:] +println "sl3:", l diff --git a/117-Slices/slices-1.gop b/117-Slices/slices-1.gop index 536866c..de79f4f 100644 --- a/117-Slices/slices-1.gop +++ b/117-Slices/slices-1.gop @@ -1,3 +1,3 @@ # Slice literals in Go style -TODO +## TODO diff --git a/119-Structs/struct.gop b/119-Structs/struct.gop index e69de29..8b13789 100644 --- a/119-Structs/struct.gop +++ b/119-Structs/struct.gop @@ -0,0 +1 @@ + diff --git a/120-Pointers/pointer.gop b/120-Pointers/pointer.gop index e69de29..8b13789 100644 --- a/120-Pointers/pointer.gop +++ b/120-Pointers/pointer.gop @@ -0,0 +1 @@ + diff --git a/121-For-Each/for-each.gop b/121-For-Each/for-each.gop new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/121-For-Each/for-each.gop @@ -0,0 +1 @@ + diff --git a/121-For-Range/range.gop b/121-For-Range/range.gop index 92a31c7..68d09b9 100644 --- a/121-For-Range/range.gop +++ b/121-For-Range/range.gop @@ -1,41 +1,41 @@ -// _range_ iterates over elements in a variety of data -// structures. Let's see how to use `range` with some -// of the data structures we've already learned. - -// Here we use `range` to sum the numbers in a slice. -// Arrays work like this too. -nums := [2, 3, 4] -sum := 0 -for _, num := range nums { - sum += num -} -println "sum:", sum - -// `range` on arrays and slices provides both the -// index and value for each entry. Above we didn't -// need the index, so we ignored it with the -// blank identifier `_`. Sometimes we actually want -// the indexes though. -for i, num := range nums { - if num == 3 { - println "index:", i - } -} - -// `range` on map iterates over key/value pairs. -kvs := {"a": "apple", "b": "banana"} -for k, v := range kvs { - printf "%s -> %s\n", k, v -} - -// `range` can also iterate over just the keys of a map. -for k := range kvs { - println "key:", k -} - -// `range` on strings iterates over Unicode code -// points. The first value is the starting byte index -// of the `rune` and the second the `rune` itself. -for i, c := range "go+" { - println i, c -} +// _range_ iterates over elements in a variety of data +// structures. Let's see how to use `range` with some +// of the data structures we've already learned. + +// Here we use `range` to sum the numbers in a slice. +// Arrays work like this too. +nums := [2, 3, 4] +sum := 0 +for _, num := range nums { + sum += num +} +println "sum:", sum + +// `range` on arrays and slices provides both the +// index and value for each entry. Above we didn't +// need the index, so we ignored it with the +// blank identifier `_`. Sometimes we actually want +// the indexes though. +for i, num := range nums { + if num == 3 { + println "index:", i + } +} + +// `range` on map iterates over key/value pairs. +kvs := {"a": "apple", "b": "banana"} +for k, v := range kvs { + printf "%s -> %s\n", k, v +} + +// `range` can also iterate over just the keys of a map. +for k := range kvs { + println "key:", k +} + +// `range` on strings iterates over Unicode code +// points. The first value is the starting byte index +// of the `rune` and the second the `rune` itself. +for i, c := range "go" { + println i, c +} diff --git a/201-Functions/funcs.gop b/201-Functions/funcs.gop index 511bc78..1e5042a 100644 --- a/201-Functions/funcs.gop +++ b/201-Functions/funcs.gop @@ -1,28 +1,28 @@ -// _Functions_ are central in Go+. We'll learn about -// functions with a few different examples. - -// Here's a function that takes two `int`s and returns -// their sum as an `int`. -func plus(a int, b int) int { - - // Go+ requires explicit returns, i.e. it won't - // automatically return the value of the last - // expression. - return a + b -} - -// When you have multiple consecutive parameters of -// the same type, you may omit the type name for the -// like-typed parameters up to the final parameter that -// declares the type. -func plusPlus(a, b, c int) int { - return a + b + c -} - -// Call a function just as you'd expect, with -// `name(args)`. -res := plus(1, 2) -println "1+2 =", res - -res = plusPlus(1, 2, 3) -println "1+2+3 =", res +// _Functions_ are central in Go+. We'll learn about +// functions with a few different examples. + +// Here's a function that takes two `int`s and returns +// their sum as an `int`. +func plus(a int, b int) int { + + // Go+ requires explicit returns, i.e. it won't + // automatically return the value of the last + // expression. + return a + b +} + +// When you have multiple consecutive parameters of +// the same type, you may omit the type name for the +// like-typed parameters up to the final parameter that +// declares the type. +func plusPlus(a, b, c int) int { + return a + b + c +} + +// Call a function just as you'd expect, with +// `name(args)`. +res := plus(1, 2) +println "1+2 =", res + +res = plusPlus(1, 2, 3) +println "1+2+3 =", res diff --git a/202-Multiple-Return-Values/multi-rets.gop b/202-Multiple-Return-Values/multi-rets.gop index 5699805..f9d6974 100644 --- a/202-Multiple-Return-Values/multi-rets.gop +++ b/202-Multiple-Return-Values/multi-rets.gop @@ -19,4 +19,4 @@ println b // If you only want a subset of the returned values, // use the blank identifier `_`. _, c := vals() -println c \ No newline at end of file +println c diff --git a/205-Closures/closures.gop b/205-Closures/closures.gop index e69de29..8b13789 100644 --- a/205-Closures/closures.gop +++ b/205-Closures/closures.gop @@ -0,0 +1 @@ + diff --git a/205-Lambda-expressions/lambda.gop b/205-Lambda-expressions/lambda.gop index e69de29..8b13789 100644 --- a/205-Lambda-expressions/lambda.gop +++ b/205-Lambda-expressions/lambda.gop @@ -0,0 +1 @@ + diff --git a/206-Recursion/recursion.gop b/206-Recursion/recursion.gop index e69de29..8b13789 100644 --- a/206-Recursion/recursion.gop +++ b/206-Recursion/recursion.gop @@ -0,0 +1 @@ + diff --git a/207-Variadic-Parameters/variadic.gop b/207-Variadic-Parameters/variadic.gop index e69de29..8b13789 100644 --- a/207-Variadic-Parameters/variadic.gop +++ b/207-Variadic-Parameters/variadic.gop @@ -0,0 +1 @@ + diff --git a/208-Defer/defer.gop b/208-Defer/defer.gop index e69de29..8b13789 100644 --- a/208-Defer/defer.gop +++ b/208-Defer/defer.gop @@ -0,0 +1 @@ + diff --git a/209-Exceptions/exceptions.gop b/209-Exceptions/exceptions.gop index e69de29..8b13789 100644 --- a/209-Exceptions/exceptions.gop +++ b/209-Exceptions/exceptions.gop @@ -0,0 +1 @@ + diff --git a/210-Methods/methods.gop b/210-Methods/methods.gop index e69de29..8b13789 100644 --- a/210-Methods/methods.gop +++ b/210-Methods/methods.gop @@ -0,0 +1 @@ + diff --git a/211-Methods-with-a-Pointer-Receiver/ptr-methods.gop b/211-Methods-with-a-Pointer-Receiver/ptr-methods.gop index e69de29..8b13789 100644 --- a/211-Methods-with-a-Pointer-Receiver/ptr-methods.gop +++ b/211-Methods-with-a-Pointer-Receiver/ptr-methods.gop @@ -0,0 +1 @@ + diff --git a/212-Composing-Types-by-Struct-Embedding/struct-emb.gop b/212-Composing-Types-by-Struct-Embedding/struct-emb.gop index e69de29..8b13789 100644 --- a/212-Composing-Types-by-Struct-Embedding/struct-emb.gop +++ b/212-Composing-Types-by-Struct-Embedding/struct-emb.gop @@ -0,0 +1 @@ + diff --git a/213-Method-Values-and-Expressions/method-values.gop b/213-Method-Values-and-Expressions/method-values.gop index e69de29..8b13789 100644 --- a/213-Method-Values-and-Expressions/method-values.gop +++ b/213-Method-Values-and-Expressions/method-values.gop @@ -0,0 +1 @@ + diff --git a/214-Encapsulation/encap.gop b/214-Encapsulation/encap.gop index e69de29..8b13789 100644 --- a/214-Encapsulation/encap.gop +++ b/214-Encapsulation/encap.gop @@ -0,0 +1 @@ + diff --git a/215-Interfaces/interfaces-1.gop b/215-Interfaces/interfaces-1.gop index fc53a80..3e86275 100644 --- a/215-Interfaces/interfaces-1.gop +++ b/215-Interfaces/interfaces-1.gop @@ -1,27 +1,29 @@ -// First, we define a very simple interface on geometry, containing the two most basic -// interface methods - calculating the area and calculating the perimeter - with the following code: -type geometry interface { - area() float64 - perim() float64 -} - -// Next, we define two structs, a rectangular struct and a circular Rectangular -// struct, with the following code: -type rect struct { - width float64, - height float64 -} - -type circle struct { - radius float64 -} - -// Then implement the interface methods defined above respectively, and the code -// related to the rectangular structure is as follows: -func (c circle) area() float64 { - return math.Pi * c.radius * c.radius -} - -func (c circle) perim() float64 { - return 2 * math.Pi * c.radius -} +import "math" + +// First, we define a very simple interface on geometry, containing the two most basic +// interface methods - calculating the area and calculating the perimeter - with the following code: +type geometry interface { + area() float64 + perim() float64 +} + +// Next, we define two structs, a rectangular struct and a circular Rectangular +// struct, with the following code: +type rect struct { + width float64 + height float64 +} + +type circle struct { + radius float64 +} + +// Then implement the interface methods defined above respectively, and the code +// related to the rectangular structure is as follows: +func (c circle) area() float64 { + return math.Pi * c.radius * c.radius +} + +func (c circle) perim() float64 { + return 2 * math.Pi * c.radius +} diff --git a/215-Interfaces/interfaces-2.gop b/215-Interfaces/interfaces-2.gop index 05c43d7..7007e35 100644 --- a/215-Interfaces/interfaces-2.gop +++ b/215-Interfaces/interfaces-2.gop @@ -1,50 +1,51 @@ // Now a complete code example to see how the interface is actually used is as follows: import ( - "math" + "math" ) type geometry interface { - area() float64 - perim() float64 + area() float64 + perim() float64 } type rect struct { - width float64 - height float64 + width float64 + height float64 } + type circle struct { - radius float64 + radius float64 } func (r rect) area() float64 { - return r.width * r.height + return r.width * r.height } + func (r rect) perim() float64 { - return 2*(r.width + r.height) + return 2 * (r.width + r.height) } func (c circle) area() float64 { - return math.Pi * c.radius * c.radius + return math.Pi * c.radius * c.radius } + func (c circle) perim() float64 { - return 2 * math.Pi * c.radius + return 2 * math.Pi * c.radius } func measure(g geometry) { - println(g) - println("area:", g.area()) - println("perimeter:", g.perim()) + println(g) + println("area:", g.area()) + println("perimeter:", g.perim()) } - r := rect{width: 6, height: 9} c := circle{radius: 2} measure(r) measure(c) - /* Run results: diff --git a/216-Interface-Satisfaction/interface-satisfy.gop b/216-Interface-Satisfaction/interface-satisfy.gop index e69de29..8b13789 100644 --- a/216-Interface-Satisfaction/interface-satisfy.gop +++ b/216-Interface-Satisfaction/interface-satisfy.gop @@ -0,0 +1 @@ + diff --git a/217-Interface-Values/interface-values.gop b/217-Interface-Values/interface-values.gop index e69de29..8b13789 100644 --- a/217-Interface-Values/interface-values.gop +++ b/217-Interface-Values/interface-values.gop @@ -0,0 +1 @@ + diff --git a/218-The-error-Interface/error.gop b/218-The-error-Interface/error.gop index e69de29..8b13789 100644 --- a/218-The-error-Interface/error.gop +++ b/218-The-error-Interface/error.gop @@ -0,0 +1 @@ + diff --git a/219-Type-Assertions/type-assert.gop b/219-Type-Assertions/type-assert.gop index e69de29..8b13789 100644 --- a/219-Type-Assertions/type-assert.gop +++ b/219-Type-Assertions/type-assert.gop @@ -0,0 +1 @@ + diff --git a/220-Type-Switches/type-switch.gop b/220-Type-Switches/type-switch.gop index 0b373b6..c7afad5 100644 --- a/220-Type-Switches/type-switch.gop +++ b/220-Type-Switches/type-switch.gop @@ -1,17 +1,17 @@ -// A type `switch` compares types instead of values. You -// can use this to discover the type of an interface -// value. In this example, the variable `t` will have the -// type corresponding to its clause. -whatAmI := func(i interface{}) { - switch t := i.(type) { - case bool: - println "I'm a bool" - case int: - println "I'm an int" - default: - printf "Don't know type %T\n", t - } -} -whatAmI true -whatAmI 1 -whatAmI "hey" +// A type `switch` compares types instead of values. You +// can use this to discover the type of an interface +// value. In this example, the variable `t` will have the +// type corresponding to its clause. +whatAmI := func(i interface{}) { + switch t := i.(type) { + case bool: + println "I'm a bool" + case int: + println "I'm an int" + default: + printf "Don't know type %T\n", t + } +} +whatAmI true +whatAmI 1 +whatAmI "hey" diff --git a/README.md b/README.md index d529c87..74dc035 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Tutorials for GoPlus (The Go+ Language) -[![Build Status](https://github.com/goplus/tutorial/actions/workflows/go.yml/badge.svg)](https://github.com/goplus/tutorial/actions/workflows/go.yml) +[![Build Status](https://github.com/goplus/tutorial/actions/workflows/gop.yml/badge.svg)](https://github.com/goplus/tutorial/actions/workflows/gop.yml) [![Tutorials](https://img.shields.io/badge/tutorial-Go+-blue.svg)](https://tutorial.goplus.org/) [![Playground](https://img.shields.io/badge/playground-Go+-blue.svg)](https://play.goplus.org/) [![Language](https://img.shields.io/badge/language-Go+-blue.svg)](https://github.com/goplus/gop) diff --git a/deep/Unix-Shebang/shebang b/_deep/Unix-Shebang/shebang similarity index 100% rename from deep/Unix-Shebang/shebang rename to _deep/Unix-Shebang/shebang diff --git a/deep/Using-goplus-in-Go/foo/foo.gop b/_deep/Using-goplus-in-Go/foo/foo.gop similarity index 100% rename from deep/Using-goplus-in-Go/foo/foo.gop rename to _deep/Using-goplus-in-Go/foo/foo.gop diff --git a/deep/Using-goplus-in-Go/foo/foo_test.gop b/_deep/Using-goplus-in-Go/foo/foo_test.gop similarity index 100% rename from deep/Using-goplus-in-Go/foo/foo_test.gop rename to _deep/Using-goplus-in-Go/foo/foo_test.gop diff --git a/deep/Using-goplus-in-Go/foo/footest_test.gop b/_deep/Using-goplus-in-Go/foo/footest_test.gop similarity index 100% rename from deep/Using-goplus-in-Go/foo/footest_test.gop rename to _deep/Using-goplus-in-Go/foo/footest_test.gop diff --git a/_todo/10-List-comprehension/list_comprehens.gop b/_todo/10-List-comprehension/list_comprehens.gop index cacd853..7f6e672 100644 --- a/_todo/10-List-comprehension/list_comprehens.gop +++ b/_todo/10-List-comprehension/list_comprehens.gop @@ -1,14 +1,14 @@ y := [x*x for x <- [1, 3, 5, 7, 11]] println(y) -y = [x*x for x <- [1, 3, 5, 7, 11], x > 3] +y = [x*x for x <- [1, 3, 5, 7, 11] if x > 3] println(y) -z := [i+v for i, v <- [1, 3, 5, 7, 11], i%2 == 1] +z := [i+v for i, v <- [1, 3, 5, 7, 11] if i%2 == 1] println(z) println([k+","+s for k, s <- {"Hello": "xsw", "Hi": "Go+"}]) arr := [1, 2, 3, 4, 5, 6] -x := [[a, b] for a <- arr, a < b for b <- arr, b > 2] +x := [[a, b] for a <- arr if a < b for b <- arr if b > 2] println("x:", x) diff --git a/_todo/11-Map-comprehension/map_comprehens.gop b/_todo/11-Map-comprehension/map_comprehens.gop index 684cbf0..23bd1f1 100644 --- a/_todo/11-Map-comprehension/map_comprehens.gop +++ b/_todo/11-Map-comprehension/map_comprehens.gop @@ -1,8 +1,8 @@ y := {x: i for i, x <- [1, 3, 5, 7, 11]} println(y) -y = {x: i for i, x <- [1, 3, 5, 7, 11], i%2 == 1} +y = {x: i for i, x <- [1, 3, 5, 7, 11] if i%2 == 1} println(y) -z := {v: k for k, v <- {1: "Hello", 3: "Hi", 5: "xsw", 7: "Go+"}, k > 3} +z := {v: k for k, v <- {1: "Hello", 3: "Hi", 5: "xsw", 7: "Go+"} if k > 3} println(z) diff --git a/_todo/12-Select-comprehension/select.gop b/_todo/12-Select-comprehension/select.gop index 25e8040..cc9ee6a 100644 --- a/_todo/12-Select-comprehension/select.gop +++ b/_todo/12-Select-comprehension/select.gop @@ -1,8 +1,8 @@ a := [2, 3, 5, 7, 9, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59] -where := {i for i, v <- a, v == 19} +where := {i for i, v <- a if v == 19} println("19 is at index", where) -if at, ok := {i for i, v <- a, v == 37}; ok { +if at, ok := {i for i, v <- a if v == 37}; ok { println("37 is found! index =", at) } diff --git a/_todo/12-Select-comprehension2/findscore.gop b/_todo/12-Select-comprehension2/findscore.gop index 3ba439a..a7845a1 100644 --- a/_todo/12-Select-comprehension2/findscore.gop +++ b/_todo/12-Select-comprehension2/findscore.gop @@ -4,7 +4,7 @@ type student struct { } func findScore(a []student, name string) (score int, ok bool) { - return {x.score for x <- a, x.name == name} + return {x.score for x <- a if x.name == name} } a := [student{"ken", 95}, student{"john", 90}, student{"tom", 58}] diff --git a/_todo/13-Exists-comprehension/exists.gop b/_todo/13-Exists-comprehension/exists.gop index 55e3165..2e4cd1b 100644 --- a/_todo/13-Exists-comprehension/exists.gop +++ b/_todo/13-Exists-comprehension/exists.gop @@ -5,8 +5,8 @@ type student struct { a := [student{"du", 84}, student{"wang", 70}, student{"ken", 100}] -hasFullMark := {for x <- a, x.score == 100} +hasFullMark := {for x <- a if x.score == 100} println("is any student full mark:", hasFullMark) -hasFailed := {for x <- a, x.score < 60} +hasFailed := {for x <- a if x.score < 60} println("is any student failed:", hasFailed) diff --git a/_todo/22-For-loop/for.gop b/_todo/22-For-loop/for.gop index 5febb6f..4eb1715 100644 --- a/_todo/22-For-loop/for.gop +++ b/_todo/22-For-loop/for.gop @@ -2,7 +2,7 @@ // for with <- sum := 0 -for x <- [1, 3, 5, 7, 11, 13, 17], x > 3 { +for x <- [1, 3, 5, 7, 11, 13, 17] if x > 3 { sum += x } println("sum(5,7,11,13,17):", sum) diff --git a/go.mod b/go.mod index 155f94a..7f9a5cd 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/goplus/tutorial go 1.16 require ( - github.com/goplus/gop v1.1.7 + github.com/goplus/gop v1.1.8 github.com/howeyc/fsnotify v0.9.0 github.com/russross/blackfriday/v2 v2.1.0 ) diff --git a/go.sum b/go.sum index 178a845..383b76d 100644 --- a/go.sum +++ b/go.sum @@ -1,87 +1,80 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/goplus/c2go v0.7.10/go.mod h1:ryOieVZqh0jmlPp45AMh9/sXIreTnyjDREP0EMX+pF0= -github.com/goplus/c2go v0.7.13/go.mod h1:s5NULWzUKi3erd3l4ahvpq+3qDGOvMjGb00a5o3h6zk= -github.com/goplus/gop v1.1.7 h1:6PemF6HYQZ2xjqIA06tQXk9LSmWz5p8+wo4UpQKTkes= -github.com/goplus/gop v1.1.7/go.mod h1:+kYk2ZSZ+rPD8AVoWTz3r5L/dkbtmUNvJOP0h1ET8KI= -github.com/goplus/gox v1.11.21/go.mod h1:wRCRSNukie4cDqADF4w0Btc2Gk6V3p3V6hI5+rsVqa8= -github.com/goplus/gox v1.11.32/go.mod h1:hdKq5ghywtKWnBJNQNVBkPITmWCqCFRwwd2LTYTfg2U= -github.com/goplus/gox v1.11.37 h1:8oAXjokhvttO/4NZgfAJ02GE9OivbX2VSsEJWu3fGng= -github.com/goplus/gox v1.11.37/go.mod h1:NkgUJWIjKxrhUwM4bgyUt3ZE0WlTunqfksMzrbnh7V8= -github.com/goplus/libc v0.3.13/go.mod h1:xqG4/g3ilKBE/UDn5vkaE7RRQPQPyspj7ecuMuvlQJ8= -github.com/goplus/mod v0.9.12/go.mod h1:YoPIowz71rnLLROA4YG0AC8bzDtPRyMaQwgTRLr8ri4= -github.com/goplus/mod v0.11.2 h1:kgIdro905lTZgqGecTbZ416O8ayN+ca2DR5OB4ayeWI= -github.com/goplus/mod v0.11.2/go.mod h1:d40I3nOr2qkGfLUjwc/BqLSq3oUUlQy5+/SpdiBKgY4= +github.com/goplus/c2go v0.7.16/go.mod h1:XODEFX2PeEEJXNLLdykWeZgMSaKJ51fVm+C9IM3FxNQ= +github.com/goplus/gop v1.1.8 h1:J04fD7uDQU4V03C/4uTtIe5u6Xnml8lySkfe7ldwS2M= +github.com/goplus/gop v1.1.8/go.mod h1:zm6P0t1neDJv7XPuJceQCnXSTWQQgba7aYk73leUs9k= +github.com/goplus/gox v1.12.1/go.mod h1:wymoQJ7ydd42cTlaXb4wNbvn4LlKjR+j8PZehI7v1zQ= +github.com/goplus/gox v1.12.5 h1:YkdsZDIOW3DZLJctWYKVzdsqMeuCYNn7J4BsFi6B058= +github.com/goplus/gox v1.12.5/go.mod h1:ferIrvJSoXae8gABk5Z4olEzfAxZpUy4hD91Vm5E/qs= +github.com/goplus/mod v0.11.5/go.mod h1:NDC5E+XOT8vcJCMjqKhLDJHTHX7lyVN4Vbfi2U7dBhs= +github.com/goplus/mod v0.11.7 h1:OTGFi/Jk0qmTy3ih8u3BQ6CbtcaPlTrJBlTacnge0jE= +github.com/goplus/mod v0.11.7/go.mod h1:yl2QncBKTdXk+8UaNsdo4u2zSpGEJYA5JKjgD3K2h00= github.com/howeyc/fsnotify v0.9.0 h1:0gtV5JmOKH4A8SsFxG2BczSeXWWPvcMT0euZt5gDAxY= github.com/howeyc/fsnotify v0.9.0/go.mod h1:41HzSPxBGeFRQKEEwgh49TRw/nKBsYZ2cF1OzPjSJsA= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/petermattis/goid v0.0.0-20220331194723-8ee3e6ded87a/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/qiniu/x v1.11.9 h1:IfQNdeNcK43Q1+b/LdrcqmWjlhxq051YVBnua8J2qN8= -github.com/qiniu/x v1.11.9/go.mod h1:03Ni9tj+N2h2aKnAz+6N0Xfl8FwMEDRC2PAlxekASDs= +github.com/qiniu/x v1.13.0/go.mod h1:INZ2TSWSJVWO/RuELQROERcslBwVgFG7MkTfEdaQz9E= +github.com/qiniu/x v1.13.1 h1:hi7tkXFq6BWGbBpMoLV7kvA2elop69j6Kl7TlxnFAiU= +github.com/qiniu/x v1.13.1/go.mod h1:INZ2TSWSJVWO/RuELQROERcslBwVgFG7MkTfEdaQz9E= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= +golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= +golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.11.1 h1:ojD5zOW8+7dOGzdnNgersm8aPfcDjhMp12UfG93NIMc= -golang.org/x/tools v0.11.1/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= +golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=