Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename error variable in go tests to err #8828 #11716

Merged
merged 21 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0e451b9
Rename error variable in go tests to err #8829
h4ck3r-04 Oct 15, 2024
6a6a4e7
Update packaging/docker/samples/golang/app/main.go
vishesh Oct 20, 2024
c3c73e8
fixed accidental renames, renamed file from directoryLayer.go to dire…
h4ck3r-04 Oct 21, 2024
61eb125
Merge remote-tracking branch 'origin/rename/go' into rename/go
h4ck3r-04 Oct 21, 2024
78cb84b
Merge branch 'apple:main' into rename/go
h4ck3r-04 Oct 21, 2024
0296934
Rename error variable in go tests to err #8829
h4ck3r-04 Oct 15, 2024
e5ca8c6
fixed accidental renames, renamed file from directoryLayer.go to dire…
h4ck3r-04 Oct 21, 2024
989b5aa
Update packaging/docker/samples/golang/app/main.go
vishesh Oct 20, 2024
aa05aea
renamed directoryPartition.go -> directory_partition.go and directory…
h4ck3r-04 Oct 21, 2024
cf190c9
Merge remote-tracking branch 'origin/rename/go' into rename/go
h4ck3r-04 Oct 21, 2024
8604396
updated: comments in files that were renamed, fixed accidental rename…
h4ck3r-04 Oct 21, 2024
c790d5d
Merge branch 'apple:main' into rename/go
h4ck3r-04 Oct 27, 2024
499ea6c
Update doc.go
h4ck3r-04 Oct 27, 2024
cb7249e
Update get_encryption_keys.go
h4ck3r-04 Oct 28, 2024
9250cd9
removed accidental whitespaces in get_encryption_keys.go
h4ck3r-04 Oct 28, 2024
fa520cc
fixed few minor issues while renaming variable
h4ck3r-04 Oct 29, 2024
04b995a
updated: minor tweaks, typos
h4ck3r-04 Oct 30, 2024
7d3a283
updated: CMakeLists
h4ck3r-04 Nov 8, 2024
27ca34e
removed: named return value
h4ck3r-04 Nov 8, 2024
5659f31
handling nil Pointer exception
h4ck3r-04 Nov 8, 2024
68acedd
Merge branch 'main' into rename/go
h4ck3r-04 Dec 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 38 additions & 38 deletions bindings/go/src/_stacktester/directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (de *DirectoryExtension) processOp(sm *StackMachine, op string, isDB bool,
}
}()

var e error
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be removed altogether?

var err error

switch {
case op == "CREATE_SUBSPACE":
Expand All @@ -142,9 +142,9 @@ func (de *DirectoryExtension) processOp(sm *StackMachine, op string, isDB bool,
if l != nil {
layer = l.([]byte)
}
d, e := de.cwd().CreateOrOpen(t, tupleToPath(tuples[0]), layer)
if e != nil {
panic(e)
d, err := de.cwd().CreateOrOpen(t, tupleToPath(tuples[0]), layer)
if err != nil {
panic(err)
}
de.store(d)
case op == "CREATE":
Expand All @@ -157,13 +157,13 @@ func (de *DirectoryExtension) processOp(sm *StackMachine, op string, isDB bool,
p := sm.waitAndPop().item
var d directory.Directory
if p == nil {
d, e = de.cwd().Create(t, tupleToPath(tuples[0]), layer)
d, err = de.cwd().Create(t, tupleToPath(tuples[0]), layer)
} else {
// p.([]byte) itself may be nil, but CreatePrefix handles that appropriately
d, e = de.cwd().CreatePrefix(t, tupleToPath(tuples[0]), layer, p.([]byte))
d, err = de.cwd().CreatePrefix(t, tupleToPath(tuples[0]), layer, p.([]byte))
}
if e != nil {
panic(e)
if err != nil {
panic(err)
}
de.store(d)
case op == "OPEN":
Expand All @@ -173,9 +173,9 @@ func (de *DirectoryExtension) processOp(sm *StackMachine, op string, isDB bool,
if l != nil {
layer = l.([]byte)
}
d, e := de.cwd().Open(rt, tupleToPath(tuples[0]), layer)
if e != nil {
panic(e)
d, err := de.cwd().Open(rt, tupleToPath(tuples[0]), layer)
if err != nil {
panic(err)
}
de.store(d)
case op == "CHANGE":
Expand All @@ -188,16 +188,16 @@ func (de *DirectoryExtension) processOp(sm *StackMachine, op string, isDB bool,
de.errorIndex = sm.waitAndPop().item.(int64)
case op == "MOVE":
tuples := sm.popTuples(2)
d, e := de.cwd().Move(t, tupleToPath(tuples[0]), tupleToPath(tuples[1]))
if e != nil {
panic(e)
d, err := de.cwd().Move(t, tupleToPath(tuples[0]), tupleToPath(tuples[1]))
if err != nil {
panic(err)
}
de.store(d)
case op == "MOVE_TO":
tuples := sm.popTuples(1)
d, e := de.cwd().MoveTo(t, tupleToPath(tuples[0]))
if e != nil {
panic(e)
d, err := de.cwd().MoveTo(t, tupleToPath(tuples[0]))
if err != nil {
panic(err)
}
de.store(d)
case strings.HasPrefix(op, "REMOVE"):
Expand All @@ -208,10 +208,10 @@ func (de *DirectoryExtension) processOp(sm *StackMachine, op string, isDB bool,
// doesn't end up committing the version key. (Other languages have
// separate remove() and remove_if_exists() so don't have this tricky
// issue).
_, e := t.Transact(func(tr fdb.Transaction) (interface{}, error) {
ok, e := de.cwd().Remove(tr, path)
if e != nil {
panic(e)
_, err := t.Transact(func(tr fdb.Transaction) (interface{}, error) {
ok, err := de.cwd().Remove(tr, path)
if err != nil {
panic(err)
}
switch op[6:] {
case "":
Expand All @@ -222,23 +222,23 @@ func (de *DirectoryExtension) processOp(sm *StackMachine, op string, isDB bool,
}
return nil, nil
})
if e != nil {
panic(e)
if err != nil {
panic(err)
}
case op == "LIST":
subs, e := de.cwd().List(rt, sm.maybePath())
if e != nil {
panic(e)
subs, err := de.cwd().List(rt, sm.maybePath())
if err != nil {
panic(err)
}
t := make(tuple.Tuple, len(subs))
for i, s := range subs {
t[i] = s
}
sm.store(idx, t.Pack())
case op == "EXISTS":
b, e := de.cwd().Exists(rt, sm.maybePath())
if e != nil {
panic(e)
b, err := de.cwd().Exists(rt, sm.maybePath())
if err != nil {
panic(err)
}
if b {
sm.store(idx, int64(1))
Expand All @@ -249,9 +249,9 @@ func (de *DirectoryExtension) processOp(sm *StackMachine, op string, isDB bool,
tuples := sm.popTuples(1)
sm.store(idx, de.css().Pack(tuples[0]))
case op == "UNPACK_KEY":
t, e := de.css().Unpack(fdb.Key(sm.waitAndPop().item.([]byte)))
if e != nil {
panic(e)
t, err := de.css().Unpack(fdb.Key(sm.waitAndPop().item.([]byte)))
if err != nil {
panic(err)
}
for _, el := range t {
sm.store(idx, el)
Expand Down Expand Up @@ -288,9 +288,9 @@ func (de *DirectoryExtension) processOp(sm *StackMachine, op string, isDB bool,
v2 := tuple.Tuple{de.cwd().GetLayer()}.Pack()
k3 := ss.Pack(tuple.Tuple{"exists"})
var v3 []byte
exists, e := de.cwd().Exists(rt, nil)
if e != nil {
panic(e)
exists, err := de.cwd().Exists(rt, nil)
if err != nil {
panic(err)
}
if exists {
v3 = tuple.Tuple{1}.Pack()
Expand All @@ -300,9 +300,9 @@ func (de *DirectoryExtension) processOp(sm *StackMachine, op string, isDB bool,
k4 := ss.Pack(tuple.Tuple{"children"})
var subs []string
if exists {
subs, e = de.cwd().List(rt, nil)
if e != nil {
panic(e)
subs, err = de.cwd().List(rt, nil)
if err != nil {
panic(err)
}
}
v4 := tuplePackStrings(subs)
Expand Down
Loading