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

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

h4ck3r-04
Copy link

@h4ck3r-04 h4ck3r-04 commented Oct 15, 2024

Renamed the variables from e to err as mentioned in the https://go.dev/doc/effective_go

According to the issue number #8828
the variables in go code were named using good and effective go practices.
Following the example link for reference mentioned in the issue the variables have been renamed.

renamed the variables from e to err as mentioned in the https://go.dev/doc/effective_go
@h4ck3r-04 h4ck3r-04 changed the title Rename error variable in go tests to err #8829 Rename error variable in go tests to err #8828 Oct 15, 2024
@jzhou77 jzhou77 closed this Oct 16, 2024
@jzhou77 jzhou77 reopened this Oct 16, 2024
@jzhou77 jzhou77 requested a review from vishesh October 16, 2024 03:50
@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-clang-ide on Linux CentOS 7

  • Commit ID: 0e451b9
  • Duration 0:21:22
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-macos-m1 on macOS Ventura 13.x

  • Commit ID: 0e451b9
  • Duration 0:42:06
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-macos on macOS Ventura 13.x

  • Commit ID: 0e451b9
  • Duration 0:50:12
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-clang-arm on Linux CentOS 7

  • Commit ID: 0e451b9
  • Duration 0:53:09
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-cluster-tests on Linux CentOS 7

  • Commit ID: 0e451b9
  • Duration 0:54:40
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)
  • Cluster Test Logs zip file of the test logs (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-clang on Linux CentOS 7

  • Commit ID: 0e451b9
  • Duration 1:03:54
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr on Linux CentOS 7

  • Commit ID: 0e451b9
  • Duration 1:10:34
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

vishesh
vishesh previously approved these changes Oct 18, 2024
Copy link
Contributor

@vishesh vishesh left a comment

Choose a reason for hiding this comment

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

Minor nit. LGTM

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-clang-ide on Linux CentOS 7

  • Commit ID: 6a6a4e7
  • Duration 0:21:18
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-macos-m1 on macOS Ventura 13.x

  • Commit ID: 6a6a4e7
  • Duration 0:42:31
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-macos on macOS Ventura 13.x

  • Commit ID: 6a6a4e7
  • Duration 0:49:57
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-clang-arm on Linux CentOS 7

  • Commit ID: 6a6a4e7
  • Duration 0:53:00
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-cluster-tests on Linux CentOS 7

  • Commit ID: 6a6a4e7
  • Duration 0:53:54
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)
  • Cluster Test Logs zip file of the test logs (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-clang on Linux CentOS 7

  • Commit ID: 6a6a4e7
  • Duration 1:04:23
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr on Linux CentOS 7

  • Commit ID: 6a6a4e7
  • Duration 1:04:26
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

recipes/go-recipes/priority.go Outdated Show resolved Hide resolved
fmt.Printf("hello is now world, foo was: %s\n", string(ret.([]byte)))
}
fmt.Printf("hello is now world, foo was: %s\n", string(ret.([]byte)))
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these whitespace changes intentional?

Copy link
Author

Choose a reason for hiding this comment

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

This might be because of the default formatter. They were not intentional

Copy link
Author

Choose a reason for hiding this comment

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

i have removed these whitespaces.

bindings/go/src/fdb/fdb.go Outdated Show resolved Hide resolved
bindings/go/src/fdb/fdb.go Outdated Show resolved Hide resolved
recipes/go-recipes/queue.go Outdated Show resolved Hide resolved
}

if len(ks) == 0 {
return 0, nil
}
k, e := prty.PrioritySS.Unpack(ks[0].Key)
k, err := prty.PrioritySS.Unpack(ks[0].Key)
Copy link
Collaborator

Choose a reason for hiding this comment

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

err here is ignored, should be evaluated.

Copy link
Author

Choose a reason for hiding this comment

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

i couldn't get it. could you come up once again.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure: I think this err is never returned to caller, so effectively is ignored.
But it's not something introduced by your PR, it just becomes evident due to the changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Assuming that k will be nil in the event of an error, that could cause an nil pointer exception.

bindings/go/src/fdb/fdb.go Outdated Show resolved Hide resolved
@@ -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?

gm42
gm42 previously approved these changes Nov 1, 2024
Copy link
Collaborator

@gm42 gm42 left a comment

Choose a reason for hiding this comment

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

Thanks for the changes!

@jzhou77 jzhou77 closed this Nov 2, 2024
@jzhou77 jzhou77 reopened this Nov 2, 2024
@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr on Linux CentOS 7

  • Commit ID: 04b995a
  • Duration 0:04:33
  • Result: ❌ FAILED
  • Error: Error while executing command: ninja -v -C build_output -j ${NPROC} all packages strip_targets. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-clang on Linux CentOS 7

  • Commit ID: 04b995a
  • Duration 0:04:41
  • Result: ❌ FAILED
  • Error: Error while executing command: ninja -v -C build_output -j ${NPROC} all packages strip_targets. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-cluster-tests on Linux CentOS 7

  • Commit ID: 04b995a
  • Duration 0:04:40
  • Result: ❌ FAILED
  • Error: Error while executing command: ninja -v -C build_output -j ${NPROC} all packages strip_targets. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)
  • Cluster Test Logs zip file of the test logs (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-clang-arm on Linux CentOS 7

  • Commit ID: 04b995a
  • Duration 0:04:40
  • Result: ❌ FAILED
  • Error: Error while executing command: ninja -v -C build_output -j ${NPROC} all packages strip_targets. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-macos-m1 on macOS Ventura 13.x

  • Commit ID: 04b995a
  • Duration 0:06:58
  • Result: ❌ FAILED
  • Error: Error while executing command: ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ${HOME}/.ssh_key ec2-user@${MAC_EC2_HOST} /opt/homebrew/bin/bash --login -c ./build_pr_macos.sh. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-macos on macOS Ventura 13.x

  • Commit ID: 04b995a
  • Duration 0:07:03
  • Result: ❌ FAILED
  • Error: Error while executing command: ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ${HOME}/.ssh_key ec2-user@${MAC_EC2_HOST} /usr/local/bin/bash --login -c ./build_pr_macos.sh. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-clang-ide on Linux CentOS 7

  • Commit ID: 04b995a
  • Duration 0:21:40
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@jzhou77
Copy link
Contributor

jzhou77 commented Nov 4, 2024

Looks like there are CI errors:

ninja: Entering directory `build_output'
[0/2] /usr/local/bin/cmake -P /codebuild/output/src805022784/src/github.com/apple/foundationdb/build_output/CMakeFiles/VerifyGlobs.cmake
ninja: error: '/codebuild/output/src805022784/src/github.com/apple/foundationdb/bindings/go/src/fdb/directory/directoryLayer.go', needed by 'bindings/go/src/github.com/apple/foundationdb/bindings/go/src/fdb/directory/directoryLayer.go', missing and no known rule to make it

bindings/go/CMakeLists.txt should be updated with file name changes.

Copy link
Contributor

@johscheuer johscheuer left a comment

Choose a reason for hiding this comment

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

Thanks for your PR. The next time it would be great to have two PR's for such things, e.g. one PR where you introduce the formatting and another PR where the variable is renamed, otherwise you'll have a huge PR which is hard to review.

@@ -1,5 +1,5 @@
/*
* directoryLayer.go
* directory_layer.go
Copy link
Contributor

Choose a reason for hiding this comment

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

This change requires a change in the cmake setup, that's the reason why all tests are failing: https://github.com/apple/foundationdb/blob/main/bindings/go/CMakeLists.txt

@@ -1,5 +1,5 @@
/*
* directoryPartition.go
* directory_partition.go
Copy link
Contributor

Choose a reason for hiding this comment

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

This change requires a change in the cmake setup, that's the reason why all tests are failing: https://github.com/apple/foundationdb/blob/main/bindings/go/CMakeLists.txt

@@ -1,5 +1,5 @@
/*
* directorySubspace.go
* directory_subspace.go
Copy link
Contributor

Choose a reason for hiding this comment

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

This change requires a change in the cmake setup, that's the reason why all tests are failing: https://github.com/apple/foundationdb/blob/main/bindings/go/CMakeLists.txt

@@ -90,7 +90,7 @@ func (d directorySubspace) Exists(rt fdb.ReadTransactor, path []string) (bool, e
return d.dl.Exists(rt, d.dl.partitionSubpath(d.path, path))
}

func (d directorySubspace) List(rt fdb.ReadTransactor, path []string) (subdirs []string, e error) {
func (d directorySubspace) List(rt fdb.ReadTransactor, path []string) (subdirs []string, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func (d directorySubspace) List(rt fdb.ReadTransactor, path []string) (subdirs []string, err error) {
func (d directorySubspace) List(rt fdb.ReadTransactor, path []string) (]string, error) {

I don't see a reason why we need a named return value here.

}

if len(ks) == 0 {
return 0, nil
}
k, e := prty.PrioritySS.Unpack(ks[0].Key)
k, err := prty.PrioritySS.Unpack(ks[0].Key)
Copy link
Contributor

Choose a reason for hiding this comment

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

Assuming that k will be nil in the event of an error, that could cause an nil pointer exception.

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-clang-ide on Linux CentOS 7

  • Commit ID: 5659f31
  • Duration 0:20:34
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-macos-m1 on macOS Ventura 13.x

  • Commit ID: 5659f31
  • Duration 0:45:12
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-macos on macOS Ventura 13.x

  • Commit ID: 5659f31
  • Duration 0:50:04
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-clang-arm on Linux CentOS 7

  • Commit ID: 5659f31
  • Duration 0:51:25
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-cluster-tests on Linux CentOS 7

  • Commit ID: 5659f31
  • Duration 0:56:13
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)
  • Cluster Test Logs zip file of the test logs (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-clang on Linux CentOS 7

  • Commit ID: 5659f31
  • Duration 0:57:20
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr on Linux CentOS 7

  • Commit ID: 5659f31
  • Duration 1:02:18
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants