Skip to content

Commit c436351

Browse files
Andrew Farriesroboquat
Andrew Farries
authored andcommitted
Run gofmt
gofmt -w . From the repository root.
1 parent 7fd0492 commit c436351

File tree

19 files changed

+133
-110
lines changed

19 files changed

+133
-110
lines changed

components/common-go/baseserver/server.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,18 @@ func New(name string, opts ...Option) (*Server, error) {
6161
// Server implements graceful shutdown making it suitable for usage in integration tests. See server_test.go.
6262
//
6363
// Server is composed of the following:
64-
// * Debug server which serves observability and debug endpoints
65-
// - /metrics for Prometheus metrics
66-
// - /pprof for Golang profiler
67-
// - /ready for kubernetes readiness check
68-
// - /live for kubernetes liveness check
69-
// * (optional) gRPC server with standard interceptors and configuration
70-
// - Started when baseserver is configured WithGRPCPort (port is non-negative)
71-
// - Use Server.GRPC() to get access to the underlying grpc.Server and register services
72-
// * (optional) HTTP server
73-
// - Currently does not come with any standard HTTP middlewares
74-
// - Started when baseserver is configured WithHTTPPort (port is non-negative)
75-
// - Use Server.HTTPMux() to get access to the root handler and register your endpoints
64+
// - Debug server which serves observability and debug endpoints
65+
// - /metrics for Prometheus metrics
66+
// - /pprof for Golang profiler
67+
// - /ready for kubernetes readiness check
68+
// - /live for kubernetes liveness check
69+
// - (optional) gRPC server with standard interceptors and configuration
70+
// - Started when baseserver is configured WithGRPCPort (port is non-negative)
71+
// - Use Server.GRPC() to get access to the underlying grpc.Server and register services
72+
// - (optional) HTTP server
73+
// - Currently does not come with any standard HTTP middlewares
74+
// - Started when baseserver is configured WithHTTPPort (port is non-negative)
75+
// - Use Server.HTTPMux() to get access to the root handler and register your endpoints
7676
type Server struct {
7777
// Name is the name of this server, used for logging context
7878
Name string

components/common-go/log/log.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ const (
3131

3232
// OWI builds a structure meant for logrus which contains the owner, workspace and instance.
3333
// Beware that this refers to the terminology outside of wsman which maps like:
34-
// owner = owner, workspace = metaID, instance = workspaceID
34+
//
35+
// owner = owner, workspace = metaID, instance = workspaceID
3536
func OWI(owner, workspace, instance string) log.Fields {
3637
return log.Fields{
3738
OwnerField: owner,
@@ -42,7 +43,8 @@ func OWI(owner, workspace, instance string) log.Fields {
4243

4344
// LogContext builds a structure meant for logrus which contains the owner, workspace and instance.
4445
// Beware that this refers to the terminology outside of wsman which maps like:
45-
// owner = owner, workspace = metaID, instance = workspaceID
46+
//
47+
// owner = owner, workspace = metaID, instance = workspaceID
4648
func LogContext(owner, workspace, instance, project, team string) log.Fields {
4749
logFields := log.Fields{}
4850

components/ee/agent-smith/cmd/testtarget/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ func main() {
1515
}
1616

1717
// don't inline to produce an elf entry
18+
//
1819
//go:noinline
1920
func agentSmithTestTarget() {
2021
fmt.Println("something")

components/gitpod-cli/cmd/credential-helper.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,11 @@ func walkProcessTree(pid int, fn pidCallbackFn) error {
230230
// - Private npm package
231231
// - Create a private git repository for an npm package e.g https://github.com/jeanp413/test-private-package
232232
// - Start a workspace, then run `npm install github:jeanp413/test-private-package` with and without permissions in the dashboard
233+
//
233234
// - Private npm package no access
234235
// - Open this workspace https://github.com/jeanp413/test-gp-bug and run `npm install`
235-
// - Observe NO notification with this message appears `Unknown repository '' Please grant the necessary permissions.`
236+
// - Observe NO notification with this message appears `Unknown repository ” Please grant the necessary permissions.`
237+
//
236238
// - Clone private repo without permission
237239
// - Start a workspace, then run `git clone 'https://gitlab.ebizmarts.com/ebizmarts/magento2-pos-api-request.git`, you should see a prompt ask your username and password, instead of `'gp credential-helper' told us to quit`
238240
func init() {

components/gitpod-protocol/go/websocket.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var (
3939
pingPeriod = (pongWait * 9) / 10
4040
)
4141

42-
//NewWebsocketConnection converts a websocket.Conn into a net.Conn
42+
// NewWebsocketConnection converts a websocket.Conn into a net.Conn
4343
func NewWebsocketConnection(ctx context.Context, websocketConn *websocket.Conn, onStale func(staleErr error)) (*WebsocketConnection, error) {
4444
ctx, cancel := context.WithCancel(ctx)
4545
c := &WebsocketConnection{
@@ -90,8 +90,8 @@ func (c *WebsocketConnection) Wait() error {
9090
return c.closeErr
9191
}
9292

93-
//Read is not threadsafe though thats okay since there
94-
//should never be more than one reader
93+
// Read is not threadsafe though thats okay since there
94+
// should never be more than one reader
9595
func (c *WebsocketConnection) Read(dst []byte) (int, error) {
9696
ldst := len(dst)
9797
//use buffer or read new message

components/ide/jetbrains/image/status/main.go

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -379,24 +379,26 @@ func updateVMOptions(config *gitpod.GitpodConfig, alias string, content string)
379379
return strings.Join(vmoptions, "\n") + "\n"
380380
}
381381

382-
/**
383-
{
384-
"buildNumber" : "221.4994.44",
385-
"customProperties" : [ ],
386-
"dataDirectoryName" : "IntelliJIdea2022.1",
387-
"launch" : [ {
388-
"javaExecutablePath" : "jbr/bin/java",
389-
"launcherPath" : "bin/idea.sh",
390-
"os" : "Linux",
391-
"startupWmClass" : "jetbrains-idea",
392-
"vmOptionsFilePath" : "bin/idea64.vmoptions"
393-
} ],
394-
"name" : "IntelliJ IDEA",
395-
"productCode" : "IU",
396-
"svgIconPath" : "bin/idea.svg",
397-
"version" : "2022.1",
398-
"versionSuffix" : "EAP"
399-
}
382+
/*
383+
*
384+
385+
{
386+
"buildNumber" : "221.4994.44",
387+
"customProperties" : [ ],
388+
"dataDirectoryName" : "IntelliJIdea2022.1",
389+
"launch" : [ {
390+
"javaExecutablePath" : "jbr/bin/java",
391+
"launcherPath" : "bin/idea.sh",
392+
"os" : "Linux",
393+
"startupWmClass" : "jetbrains-idea",
394+
"vmOptionsFilePath" : "bin/idea64.vmoptions"
395+
} ],
396+
"name" : "IntelliJ IDEA",
397+
"productCode" : "IU",
398+
"svgIconPath" : "bin/idea.svg",
399+
"version" : "2022.1",
400+
"versionSuffix" : "EAP"
401+
}
400402
*/
401403
type ProductInfo struct {
402404
Version string `json:"version"`

components/licensor/typescript/ee/main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ var (
2020
)
2121

2222
// Init initializes the global license evaluator from an environment variable
23+
//
2324
//export Init
2425
func Init(key *C.char, domain *C.char) (id int) {
2526
id = nextID
@@ -36,6 +37,7 @@ func Init(key *C.char, domain *C.char) (id int) {
3637
}
3738

3839
// GetLicenseData returns the info about license for the admin dashboard
40+
//
3941
//export GetLicenseData
4042
func GetLicenseData(id int) (licData *C.char, ok bool) {
4143
e, ok := instances[id]
@@ -54,6 +56,7 @@ func GetLicenseData(id int) (licData *C.char, ok bool) {
5456
}
5557

5658
// Validate returns false if the license isn't valid and a message explaining why that is.
59+
//
5760
//export Validate
5861
func Validate(id int) (msg *C.char, valid bool) {
5962
e, ok := instances[id]
@@ -66,6 +69,7 @@ func Validate(id int) (msg *C.char, valid bool) {
6669
}
6770

6871
// Enabled returns true if a license enables a feature
72+
//
6973
//export Enabled
7074
func Enabled(id int, feature *C.char, seats int) (enabled, ok bool) {
7175
e, ok := instances[id]
@@ -77,6 +81,7 @@ func Enabled(id int, feature *C.char, seats int) (enabled, ok bool) {
7781
}
7882

7983
// HasEnoughSeats returns true if the license supports at least the given number of seats.
84+
//
8085
//export HasEnoughSeats
8186
func HasEnoughSeats(id int, seats int) (permitted, ok bool) {
8287
e, ok := instances[id]
@@ -88,6 +93,7 @@ func HasEnoughSeats(id int, seats int) (permitted, ok bool) {
8893
}
8994

9095
// Inspect returns the license information this evaluator holds.
96+
//
9197
//export Inspect
9298
func Inspect(id int) (lic *C.char, ok bool) {
9399
e, ok := instances[id]
@@ -105,6 +111,7 @@ func Inspect(id int) (lic *C.char, ok bool) {
105111
}
106112

107113
// Dispose removes/disposes an instance formerly created using Init. If the id does not exist, nothing happens.
114+
//
108115
//export Dispose
109116
func Dispose(id int) {
110117
delete(instances, id)

components/proxy/plugins/logif/caddyfile.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ import (
1313
// UnmarshalCaddyfile sets up the module form Caddyfile tokens.
1414
//
1515
// Syntax:
16-
// if {
17-
// "<expression>"
18-
// } [<encoder>]
16+
//
17+
// if {
18+
// "<expression>"
19+
// } [<encoder>]
1920
//
2021
// The <expression> must be on a single line.
2122
// Refer to `lang.Lang` for its syntax.

components/proxy/plugins/workspacedownload/workspace_download.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,4 @@ func (n *noBufferWriter) Write(p []byte) (written int, err error) {
171171
}
172172

173173
return
174-
}
174+
}

components/workspacekit/cmd/rings.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,8 @@ var (
623623
// That's how configMaps and secrets behave in Kubernetes.
624624
//
625625
// Note/Caveat: configMap or secret volumes with a subPath do not behave as described above and will not be recognised by this function.
626-
// in those cases you'll want to use GITPOD_WORKSPACEKIT_BIND_MOUNTS to explicitely list those paths.
626+
//
627+
// in those cases you'll want to use GITPOD_WORKSPACEKIT_BIND_MOUNTS to explicitely list those paths.
627628
func findBindMountCandidates(procMounts io.Reader, readlink func(path string) (dest string, err error)) (mounts []string, err error) {
628629
scanner := bufio.NewScanner(procMounts)
629630
for scanner.Scan() {

components/ws-daemon/pkg/cpulimit/cpulimit.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,12 @@ type Bucket struct {
274274
// BucketLimiter limits CPU use based on different "pots of CPU time".
275275
// The current limit is decided by the current bucket which is taken in order.
276276
// For example:
277-
// buckets = [ { Budget: 50, Limit: 20 }, { Budget: 20, Limit: 10 }, { Budget: 0, Limit: 5 } ]
278-
// budgetSpent = totalBudget - budgetLeft == 65
279-
// then the current limit is 10, because we have spent all our budget from bucket 0, and are currently
280-
// spending from the second bucket.
277+
//
278+
// buckets = [ { Budget: 50, Limit: 20 }, { Budget: 20, Limit: 10 }, { Budget: 0, Limit: 5 } ]
279+
// budgetSpent = totalBudget - budgetLeft == 65
280+
// then the current limit is 10, because we have spent all our budget from bucket 0, and are currently
281+
// spending from the second bucket.
282+
//
281283
// The last bucket's Budget is always ignored and becomes the default limit if all other
282284
// buckets are used up.
283285
// If the list of buckets is empty, this limiter limits to zero.

components/ws-daemon/pkg/iws/iws.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,8 @@ func (wbs *InWorkspaceServiceServer) WriteIDMapping(ctx context.Context, req *ap
934934
//
935935
// <container-cgorup> drwxr-xr-x 3 root root
936936
// └── workspace drwxr-xr-x 5 gitpodUid gitpodGid
937-
// └── user drwxr-xr-x 5 gitpodUid gitpodGid
937+
//
938+
// └── user drwxr-xr-x 5 gitpodUid gitpodGid
938939
func (wbs *InWorkspaceServiceServer) EvacuateCGroup(ctx context.Context, req *api.EvacuateCGroupRequest) (*api.EvacuateCGroupResponse, error) {
939940
unified, err := cgroups.IsUnifiedCgroupSetup()
940941
if err != nil {

components/ws-manager/pkg/clock/clock.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,19 @@ import (
1212
)
1313

1414
// This clock roughly implements a Hybrid Logical Clock (HLC) as described in
15-
// Logical Physical Clocks and Consistent Snapshots in Globally Distributed Databases
16-
// Kulkarni et al.
17-
// https://cse.buffalo.edu/tech-reports/2014-04.pdf
15+
//
16+
// Logical Physical Clocks and Consistent Snapshots in Globally Distributed Databases
17+
// Kulkarni et al.
18+
// https://cse.buffalo.edu/tech-reports/2014-04.pdf
1819
//
1920
// This implementation is very much geared towards single process use, yet still
2021
// protects us from the funny bits of physical wall time, e.g. clock skew or time
2122
// running backwards. Also, this implementation is naively synchronised using a simple mutex.
2223
//
2324
// In the future, if we ever make ws-manager properly distributed, we might want
2425
// to take inspiration from cockroachDB's implementation:
25-
// https://github.com/cockroachdb/cockroach/blob/master/pkg/util/hlc/hlc.go
26+
//
27+
// https://github.com/cockroachdb/cockroach/blob/master/pkg/util/hlc/hlc.go
2628
type HLC struct {
2729
physicalTime func() uint64
2830
backwardsFlowReporter func(diff uint64)
@@ -37,8 +39,9 @@ type HLC struct {
3739

3840
// System takes the wall time from the actual system time.
3941
// Beware: when using the clock wall time, it's a good idea to wait out
40-
// the maximum expected real wall time skew, e.g. as imposed by
41-
// NTP. time.Sleep(2*time.Second) should be enough in most cases.
42+
//
43+
// the maximum expected real wall time skew, e.g. as imposed by
44+
// NTP. time.Sleep(2*time.Second) should be enough in most cases.
4245
func System() *HLC {
4346
return &HLC{
4447
physicalTime: func() uint64 { return uint64(time.Now().Unix()) },
@@ -59,7 +62,8 @@ const (
5962
// ReportBackwardsTime registers a reporter which gets called when the wall time
6063
// does not increase monotonously.
6164
// Beware: this function is not synchronised with Tick() and must not be called
62-
// concurrently.
65+
//
66+
// concurrently.
6367
func (c *HLC) ReportBackwardsTime(r func(diff uint64)) {
6468
c.backwardsFlowReporter = r
6569
}

components/ws-manager/pkg/manager/internal/workpool/workpool.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030
// Why not use kubernetes/client-go/workqueue?
3131
// We have different requirements than the workqueue. The Kubernetes workqueue cares about the order/
3232
// execution of single items. We care about the order of several items grouped by some factor.
33-
//
3433
type EventWorkerPool struct {
3534
WorkOn func(watch.Event)
3635

components/ws-manager/pkg/manager/manager.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,7 @@ func (m *Manager) findWorkspacePod(ctx context.Context, workspaceID string) (*co
863863
}
864864

865865
// getPodID computes the pod ID from a workpace ID
866+
//
866867
//nolint:unused,deadcode
867868
func getPodID(workspaceType, workspaceID string) string {
868869
return fmt.Sprintf("%s-%s", strings.TrimSpace(strings.ToLower(workspaceType)), strings.TrimSpace(workspaceID))

0 commit comments

Comments
 (0)