Skip to content

Commit 2e239fa

Browse files
committed
go fmt ...
1 parent 42030a7 commit 2e239fa

File tree

4 files changed

+73
-79
lines changed

4 files changed

+73
-79
lines changed

internal/chunkedfile/chunkedfile.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
//
1414
// Example:
1515
//
16-
// x = 1 / 0 ### "division by zero"
17-
// ---
18-
// x = 1
19-
// print(x + "") ### "int + string not supported"
16+
// x = 1 / 0 ### "division by zero"
17+
// ---
18+
// x = 1
19+
// print(x + "") ### "int + string not supported"
2020
//
2121
// A client test feeds each chunk of text into the program under test,
2222
// then calls chunk.GotError for each error that actually occurred. Any

lib/math/math.go

+37-37
Original file line numberDiff line numberDiff line change
@@ -17,53 +17,52 @@ import (
1717
// Module math is a Starlark module of math-related functions and constants.
1818
// The module defines the following functions:
1919
//
20-
// ceil(x) - Returns the ceiling of x, the smallest integer greater than or equal to x.
21-
// copysign(x, y) - Returns a value with the magnitude of x and the sign of y.
22-
// fabs(x) - Returns the absolute value of x as float.
23-
// floor(x) - Returns the floor of x, the largest integer less than or equal to x.
24-
// mod(x, y) - Returns the floating-point remainder of x/y. The magnitude of the result is less than y and its sign agrees with that of x.
25-
// pow(x, y) - Returns x**y, the base-x exponential of y.
26-
// remainder(x, y) - Returns the IEEE 754 floating-point remainder of x/y.
27-
// round(x) - Returns the nearest integer, rounding half away from zero.
20+
// ceil(x) - Returns the ceiling of x, the smallest integer greater than or equal to x.
21+
// copysign(x, y) - Returns a value with the magnitude of x and the sign of y.
22+
// fabs(x) - Returns the absolute value of x as float.
23+
// floor(x) - Returns the floor of x, the largest integer less than or equal to x.
24+
// mod(x, y) - Returns the floating-point remainder of x/y. The magnitude of the result is less than y and its sign agrees with that of x.
25+
// pow(x, y) - Returns x**y, the base-x exponential of y.
26+
// remainder(x, y) - Returns the IEEE 754 floating-point remainder of x/y.
27+
// round(x) - Returns the nearest integer, rounding half away from zero.
2828
//
29-
// exp(x) - Returns e raised to the power x, where e = 2.718281… is the base of natural logarithms.
30-
// sqrt(x) - Returns the square root of x.
29+
// exp(x) - Returns e raised to the power x, where e = 2.718281… is the base of natural logarithms.
30+
// sqrt(x) - Returns the square root of x.
3131
//
32-
// acos(x) - Returns the arc cosine of x, in radians.
33-
// asin(x) - Returns the arc sine of x, in radians.
34-
// atan(x) - Returns the arc tangent of x, in radians.
35-
// atan2(y, x) - Returns atan(y / x), in radians.
36-
// The result is between -pi and pi.
37-
// The vector in the plane from the origin to point (x, y) makes this angle with the positive X axis.
38-
// The point of atan2() is that the signs of both inputs are known to it, so it can compute the correct
39-
// quadrant for the angle.
40-
// For example, atan(1) and atan2(1, 1) are both pi/4, but atan2(-1, -1) is -3*pi/4.
41-
// cos(x) - Returns the cosine of x, in radians.
42-
// hypot(x, y) - Returns the Euclidean norm, sqrt(x*x + y*y). This is the length of the vector from the origin to point (x, y).
43-
// sin(x) - Returns the sine of x, in radians.
44-
// tan(x) - Returns the tangent of x, in radians.
32+
// acos(x) - Returns the arc cosine of x, in radians.
33+
// asin(x) - Returns the arc sine of x, in radians.
34+
// atan(x) - Returns the arc tangent of x, in radians.
35+
// atan2(y, x) - Returns atan(y / x), in radians.
36+
// The result is between -pi and pi.
37+
// The vector in the plane from the origin to point (x, y) makes this angle with the positive X axis.
38+
// The point of atan2() is that the signs of both inputs are known to it, so it can compute the correct
39+
// quadrant for the angle.
40+
// For example, atan(1) and atan2(1, 1) are both pi/4, but atan2(-1, -1) is -3*pi/4.
41+
// cos(x) - Returns the cosine of x, in radians.
42+
// hypot(x, y) - Returns the Euclidean norm, sqrt(x*x + y*y). This is the length of the vector from the origin to point (x, y).
43+
// sin(x) - Returns the sine of x, in radians.
44+
// tan(x) - Returns the tangent of x, in radians.
4545
//
46-
// degrees(x) - Converts angle x from radians to degrees.
47-
// radians(x) - Converts angle x from degrees to radians.
46+
// degrees(x) - Converts angle x from radians to degrees.
47+
// radians(x) - Converts angle x from degrees to radians.
4848
//
49-
// acosh(x) - Returns the inverse hyperbolic cosine of x.
50-
// asinh(x) - Returns the inverse hyperbolic sine of x.
51-
// atanh(x) - Returns the inverse hyperbolic tangent of x.
52-
// cosh(x) - Returns the hyperbolic cosine of x.
53-
// sinh(x) - Returns the hyperbolic sine of x.
54-
// tanh(x) - Returns the hyperbolic tangent of x.
49+
// acosh(x) - Returns the inverse hyperbolic cosine of x.
50+
// asinh(x) - Returns the inverse hyperbolic sine of x.
51+
// atanh(x) - Returns the inverse hyperbolic tangent of x.
52+
// cosh(x) - Returns the hyperbolic cosine of x.
53+
// sinh(x) - Returns the hyperbolic sine of x.
54+
// tanh(x) - Returns the hyperbolic tangent of x.
5555
//
56-
// log(x, base) - Returns the logarithm of x in the given base, or natural logarithm by default.
56+
// log(x, base) - Returns the logarithm of x in the given base, or natural logarithm by default.
5757
//
58-
// gamma(x) - Returns the Gamma function of x.
58+
// gamma(x) - Returns the Gamma function of x.
5959
//
6060
// All functions accept both int and float values as arguments.
6161
//
6262
// The module also defines approximations of the following constants:
6363
//
64-
// e - The base of natural logarithms, approximately 2.71828.
65-
// pi - The ratio of a circle's circumference to its diameter, approximately 3.14159.
66-
//
64+
// e - The base of natural logarithms, approximately 2.71828.
65+
// pi - The ratio of a circle's circumference to its diameter, approximately 3.14159.
6766
var Module = &starlarkstruct.Module{
6867
Name: "math",
6968
Members: starlark.StringDict{
@@ -146,7 +145,8 @@ func newBinaryBuiltin(name string, fn func(float64, float64) float64) *starlark.
146145
})
147146
}
148147

149-
// log wraps the Log function
148+
// log wraps the Log function
149+
//
150150
// as a Starlark built-in that accepts int or float arguments.
151151
func log(thread *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
152152
var (

lib/proto/proto.go

+29-33
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99
//
1010
// This package defines several types of Starlark value:
1111
//
12-
// Message -- a protocol message
13-
// RepeatedField -- a repeated field of a message, like a list
12+
// Message -- a protocol message
13+
// RepeatedField -- a repeated field of a message, like a list
1414
//
15-
// FileDescriptor -- information about a .proto file
16-
// FieldDescriptor -- information about a message field (or extension field)
17-
// MessageDescriptor -- information about the type of a message
18-
// EnumDescriptor -- information about an enumerated type
19-
// EnumValueDescriptor -- a value of an enumerated type
15+
// FileDescriptor -- information about a .proto file
16+
// FieldDescriptor -- information about a message field (or extension field)
17+
// MessageDescriptor -- information about the type of a message
18+
// EnumDescriptor -- information about an enumerated type
19+
// EnumValueDescriptor -- a value of an enumerated type
2020
//
2121
// A Message value is a wrapper around a protocol message instance.
2222
// Starlark programs may access and update Messages using dot notation:
2323
//
24-
// x = msg.field
25-
// msg.field = x + 1
26-
// msg.field += 1
24+
// x = msg.field
25+
// msg.field = x + 1
26+
// msg.field += 1
2727
//
2828
// Assignments to message fields perform dynamic checks on the type and
2929
// range of the value to ensure that the message is at all times valid.
@@ -35,31 +35,30 @@
3535
// performs a dynamic check to ensure that the RepeatedField holds
3636
// only elements of the correct type.
3737
//
38-
// type(msg.uint32s) # "proto.repeated<uint32>"
39-
// msg.uint32s[0] = 1
40-
// msg.uint32s[0] = -1 # error: invalid uint32: -1
38+
// type(msg.uint32s) # "proto.repeated<uint32>"
39+
// msg.uint32s[0] = 1
40+
// msg.uint32s[0] = -1 # error: invalid uint32: -1
4141
//
4242
// Any iterable may be assigned to a repeated field of a message. If
4343
// the iterable is itself a value of type RepeatedField, the message
4444
// field holds a reference to it.
4545
//
46-
// msg2.uint32s = msg.uint32s # both messages share one RepeatedField
47-
// msg.uint32s[0] = 123
48-
// print(msg2.uint32s[0]) # "123"
46+
// msg2.uint32s = msg.uint32s # both messages share one RepeatedField
47+
// msg.uint32s[0] = 123
48+
// print(msg2.uint32s[0]) # "123"
4949
//
5050
// The RepeatedFields' element types must match.
5151
// It is not enough for the values to be merely valid:
5252
//
53-
// msg.uint32s = [1, 2, 3] # makes a copy
54-
// msg.uint64s = msg.uint32s # error: repeated field has wrong type
55-
// msg.uint64s = list(msg.uint32s) # ok; makes a copy
53+
// msg.uint32s = [1, 2, 3] # makes a copy
54+
// msg.uint64s = msg.uint32s # error: repeated field has wrong type
55+
// msg.uint64s = list(msg.uint32s) # ok; makes a copy
5656
//
5757
// For all other iterables, a new RepeatedField is constructed from the
5858
// elements of the iterable.
5959
//
60-
// msg.uints32s = [1, 2, 3]
61-
// print(type(msg.uints32s)) # "proto.repeated<uint32>"
62-
//
60+
// msg.uints32s = [1, 2, 3]
61+
// print(type(msg.uints32s)) # "proto.repeated<uint32>"
6362
//
6463
// To construct a Message from encoded binary or text data, call
6564
// Unmarshal or UnmarshalText. These two functions are exposed to
@@ -75,7 +74,6 @@
7574
//
7675
// See proto_test.go for an example of how to use the 'proto'
7776
// module in an application that embeds Starlark.
78-
//
7977
package proto
8078

8179
// TODO(adonovan): Go and Starlark API improvements:
@@ -111,8 +109,8 @@ import (
111109
// for a Starlark thread to use this package.
112110
//
113111
// For example:
114-
// SetPool(thread, protoregistry.GlobalFiles)
115112
//
113+
// SetPool(thread, protoregistry.GlobalFiles)
116114
func SetPool(thread *starlark.Thread, pool DescriptorPool) {
117115
thread.SetLocal(contextKey, pool)
118116
}
@@ -305,10 +303,9 @@ func getFieldStarlark(thread *starlark.Thread, fn *starlark.Builtin, args starla
305303
// When a message descriptor is called, it returns a new instance of the
306304
// protocol message it describes.
307305
//
308-
// Message(msg) -- return a shallow copy of an existing message
309-
// Message(k=v, ...) -- return a new message with the specified fields
310-
// Message(dict(...)) -- return a new message with the specified fields
311-
//
306+
// Message(msg) -- return a shallow copy of an existing message
307+
// Message(k=v, ...) -- return a new message with the specified fields
308+
// Message(dict(...)) -- return a new message with the specified fields
312309
func (d MessageDescriptor) CallInternal(thread *starlark.Thread, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
313310
dest := &Message{
314311
msg: newMessage(d.Desc),
@@ -1219,11 +1216,10 @@ func enumValueOf(enum protoreflect.EnumDescriptor, x starlark.Value) (protorefle
12191216
//
12201217
// An EnumValueDescriptor has the following fields:
12211218
//
1222-
// index -- int, index of this value within the enum sequence
1223-
// name -- string, name of this enum value
1224-
// number -- int, numeric value of this enum value
1225-
// type -- EnumDescriptor, the enum type to which this value belongs
1226-
//
1219+
// index -- int, index of this value within the enum sequence
1220+
// name -- string, name of this enum value
1221+
// number -- int, numeric value of this enum value
1222+
// type -- EnumDescriptor, the enum type to which this value belongs
12271223
type EnumValueDescriptor struct {
12281224
Desc protoreflect.EnumValueDescriptor
12291225
}

starlarkstruct/struct.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
// Package starlarkstruct defines the Starlark types 'struct' and
66
// 'module', both optional language extensions.
7-
//
87
package starlarkstruct // import "go.starlark.net/starlarkstruct"
98

109
// It is tempting to introduce a variant of Struct that is a wrapper
@@ -36,10 +35,9 @@ import (
3635
//
3736
// An application can add 'struct' to the Starlark environment like so:
3837
//
39-
// globals := starlark.StringDict{
40-
// "struct": starlark.NewBuiltin("struct", starlarkstruct.Make),
41-
// }
42-
//
38+
// globals := starlark.StringDict{
39+
// "struct": starlark.NewBuiltin("struct", starlarkstruct.Make),
40+
// }
4341
func Make(_ *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
4442
if len(args) > 0 {
4543
return nil, fmt.Errorf("struct: unexpected positional arguments")

0 commit comments

Comments
 (0)