Skip to content

Commit 87d2e19

Browse files
takumakumepgier
authored andcommitted
update fixtures for proc environ
Signed-off-by: takumakume <[email protected]>
1 parent a7b3dac commit 87d2e19

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

fixtures.ttar

+5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ Mode: 644
2121
Path: fixtures/proc/26231/cwd
2222
SymlinkTo: /usr/bin
2323
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
24+
Path: fixtures/proc/26231/environ
25+
Lines: 1
26+
PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binNULLBYTEHOSTNAME=cd24e11f73a5NULLBYTETERM=xtermNULLBYTEGOLANG_VERSION=1.12.5NULLBYTEGOPATH=/goNULLBYTEHOME=/rootNULLBYTEEOF
27+
Mode: 644
28+
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2429
Path: fixtures/proc/26231/exe
2530
SymlinkTo: /usr/bin/vim
2631
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

proc_environ.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018 The Prometheus Authors
1+
// Copyright 2019 The Prometheus Authors
22
// Licensed under the Apache License, Version 2.0 (the "License");
33
// you may not use this file except in compliance with the License.
44
// You may obtain a copy of the License at
@@ -19,7 +19,7 @@ import (
1919
"strings"
2020
)
2121

22-
// IO creates a new ProcIO instance from a given Proc instance.
22+
// Environ reads process environments from /proc/<pid>/environ
2323
func (p Proc) Environ() ([]string, error) {
2424
environments := make([]string, 0)
2525

@@ -36,7 +36,7 @@ func (p Proc) Environ() ([]string, error) {
3636

3737
environments = strings.Split(string(data), "\000")
3838
if len(environments) > 0 {
39-
environments = environments[:len(environments) - 1]
39+
environments = environments[:len(environments)-1]
4040
}
4141

4242
return environments, nil

proc_environ_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018 The Prometheus Authors
1+
// Copyright 2019 The Prometheus Authors
22
// Licensed under the Apache License, Version 2.0 (the "License");
33
// you may not use this file except in compliance with the License.
44
// You may obtain a copy of the License at

0 commit comments

Comments
 (0)