Skip to content

Commit

Permalink
[WORKFLOW] Updating go dependencies (#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnN193 authored Oct 9, 2024
1 parent d6f1ba8 commit b1694ec
Show file tree
Hide file tree
Showing 12 changed files with 464 additions and 499 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/bump_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
sudo chown -R testbot .
sudo -u testbot bash -lc 'go get go.viam.com/rdk'
sudo -u testbot bash -lc 'go get go.viam.com/api'
sudo -u testbot bash -lc 'go mod tidy'
GEN_DIFF=$(git status -s)
if [ -n "$GEN_DIFF" ]; then
Expand All @@ -43,6 +44,7 @@ jobs:
title: Automated Go Dependencies Update
body: This is an auto-generated PR to update go dependencies. Please confirm tests are passing before merging.
reviewers: JohnN193
draft: always-true

slack-workflow-status:
if: ${{ failure() }}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ endif

build: cartographer-module

viam-cartographer/build/unit_tests: ensure-submodule-initialized grpc/buf
viam-cartographer/build/unit_tests: ensure-submodule-initialized
cd viam-cartographer && cmake -B$(BUILD_DIR) -G Ninja ${EXTRA_CMAKE_FLAGS} && cmake --build $(BUILD_DIR)

cartographer-module: viam-cartographer/build/unit_tests
Expand Down
6 changes: 3 additions & 3 deletions cartofacade/capi.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ type CartoInterface interface {
start() error
stop() error
terminate() error
addLidarReading(string, s.TimedLidarReadingResponse) error
addIMUReading(string, s.TimedIMUReadingResponse) error
addOdometerReading(string, s.TimedOdometerReadingResponse) error
addLidarReading(lidar string, reading s.TimedLidarReadingResponse) error
addIMUReading(movementSensor string, reading s.TimedIMUReadingResponse) error
addOdometerReading(movementSensor string, reading s.TimedOdometerReadingResponse) error
position() (Position, error)
pointCloudMap() ([]byte, error)
internalState() ([]byte, error)
Expand Down
3 changes: 2 additions & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ func TestValidate(t *testing.T) {
cfgService.Attributes[key] = true

_, err := newConfig(cfgService)
msg := fmt.Sprintf("1 error(s) decoding:\n\n* '%s' expected type 'string', got unconvertible type 'bool', value: 'true'", key)
msg := fmt.Sprintf("decoding failed due to the following error(s):\n\n'%s' expected type 'string'"+
", got unconvertible type 'bool', value: 'true'", key)
expE := newError(msg)
test.That(t, err, test.ShouldBeError, expE)

Expand Down
5 changes: 4 additions & 1 deletion etc/golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ linters:
- maintidx
- maligned
- makezero
- mnd
- musttag
- nakedret
- nestif
Expand Down Expand Up @@ -70,7 +71,9 @@ linters-settings:
extra-rules: true
gosec:
excludes:
- G601
- G115 # TODO(go1.23): maybe reenable
- G301
- G306
govet:
enable-all: true
disable:
Expand Down
268 changes: 137 additions & 131 deletions go.mod

Large diffs are not rendered by default.

636 changes: 304 additions & 332 deletions go.sum

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions postprocess/postprocess_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package postprocess
import (
"bytes"
"errors"
"fmt"
"image/color"
"math"
"testing"
Expand Down Expand Up @@ -52,13 +51,13 @@ func TestParseDoCommand(t *testing.T) {
err: errYNotFloat64,
},
} {
t.Run(fmt.Sprintf("%s for Add task", tc.msg), func(t *testing.T) {
t.Run(tc.msg+" for Add task", func(t *testing.T) {
task, err := ParseDoCommand(tc.cmd, Add)
test.That(t, err, test.ShouldBeError, tc.err)
test.That(t, task, test.ShouldResemble, Task{})
})

t.Run(fmt.Sprintf("%s for Remove task", tc.msg), func(t *testing.T) {
t.Run(tc.msg+" for Remove task", func(t *testing.T) {
task, err := ParseDoCommand(tc.cmd, Remove)
test.That(t, err, test.ShouldBeError, tc.err)
test.That(t, task, test.ShouldResemble, Task{})
Expand Down
8 changes: 4 additions & 4 deletions sensorprocess/sensorprocess_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package sensorprocess
import (
"context"
"errors"
"fmt"
"strconv"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -264,7 +264,7 @@ func TestStartOfflineSensorProcess(t *testing.T) {
cf.AddLidarReadingFunc = func(ctx context.Context, timeout time.Duration,
lidarName string, currentReading s.TimedLidarReadingResponse,
) error {
actualDataInsertions = append(actualDataInsertions, "lidar: "+fmt.Sprint(tt.lidarReadingTimeAddedMs[numLidarData-1]))
actualDataInsertions = append(actualDataInsertions, "lidar: "+strconv.Itoa(tt.lidarReadingTimeAddedMs[numLidarData-1]))
countAddedLidarData++
return nil
}
Expand All @@ -273,7 +273,7 @@ func TestStartOfflineSensorProcess(t *testing.T) {
cf.AddIMUReadingFunc = func(ctx context.Context, timeout time.Duration,
imuName string, currentReading s.TimedIMUReadingResponse,
) error {
actualDataInsertions = append(actualDataInsertions, "imu: "+fmt.Sprint(tt.msReadingTimeAddedMs[numMovementSensorData-1]))
actualDataInsertions = append(actualDataInsertions, "imu: "+strconv.Itoa(tt.msReadingTimeAddedMs[numMovementSensorData-1]))
countAddedIMUData++
return nil
}
Expand All @@ -282,7 +282,7 @@ func TestStartOfflineSensorProcess(t *testing.T) {
cf.AddOdometerReadingFunc = func(ctx context.Context, timeout time.Duration,
odometerName string, currentReading s.TimedOdometerReadingResponse,
) error {
actualDataInsertions = append(actualDataInsertions, "odometer: "+fmt.Sprint(tt.msReadingTimeAddedMs[numMovementSensorData-1]))
actualDataInsertions = append(actualDataInsertions, "odometer: "+strconv.Itoa(tt.msReadingTimeAddedMs[numMovementSensorData-1]))
countAddedOdometerData++
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions testhelper/integrationtesthelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ func integrationTimedMovementSensor(
) (s.TimedMovementSensor, error) {
// Return nil if movement sensor is not defined
if movementSensor["name"] == "" {
return nil, nil
return nil, errors.New("movement sensor is undefined")
}

// Check that the required amount of movement sensor data is present and
Expand Down Expand Up @@ -639,7 +639,7 @@ func mockLidarReadingsValid() error {
if len(files) < NumPointCloudFiles {
return errors.Errorf("expected at least %v lidar reading files for integration test", NumPointCloudFiles)
}
for i := 0; i < NumPointCloudFiles; i++ {
for i := range NumPointCloudFiles {
found := false
expectedFile := fmt.Sprintf("%d.pcd", i)
for _, file := range files {
Expand Down
22 changes: 2 additions & 20 deletions viam-cartographer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,11 @@ if(DEFINED ENV{API_SOURCE_DIR})
else()
set(API_SOURCE_DIR ${PROJECT_SOURCE_DIR}/..)
endif()
set(GRPC_SRC_DIR ${API_SOURCE_DIR}/grpc/cpp/gen)

if(NOT EXISTS ${GRPC_SRC_DIR})
message(FATAL_ERROR
"RDK C++ gRPC gen files not found. Please specify the absolute path to your API_SOURCE_DIR e.g. 'export API_SOURCE_DIR=/home/user/api'"
)
endif()


message("PROJECT SOURCE DIR: " ${PROJECT_SOURCE_DIR})
message("API SOURCE DIR: " ${API_SOURCE_DIR})
message("GRPC SOURCE DIR: " ${GRPC_SRC_DIR})


# dependencies
Expand Down Expand Up @@ -52,20 +46,8 @@ list(APPEND ALL_LIBRARY_HDRS ${ALL_VIAM_HDRS})
list(APPEND ALL_LIBRARY_SRCS ${ALL_VIAM_SRCS})
list(APPEND ALL_LIBRARY_SRCS ${ALL_VIAM_C_SRCS})

# add grpc/API sources
set(GRPC_SRCS
${GRPC_SRC_DIR}/service/slam/v1/slam.grpc.pb.cc
${GRPC_SRC_DIR}/service/slam/v1/slam.pb.cc
${GRPC_SRC_DIR}/common/v1/common.grpc.pb.cc
${GRPC_SRC_DIR}/common/v1/common.pb.cc
${GRPC_SRC_DIR}/google/api/annotations.pb.cc
${GRPC_SRC_DIR}/google/api/httpbody.pb.cc
${GRPC_SRC_DIR}/google/api/http.pb.cc
)

# the viam-cartographer library
add_library(${PROJECT_NAME} STATIC ${ALL_LIBRARY_HDRS} ${ALL_LIBRARY_SRCS} ${GRPC_SRCS})
target_include_directories(${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${GRPC_SRC_DIR}>)
add_library(${PROJECT_NAME} STATIC ${ALL_LIBRARY_HDRS} ${ALL_LIBRARY_SRCS})
target_link_libraries(${PROJECT_NAME} PUBLIC
cartographer
${GRPCPP_LIBRARIES}
Expand Down
2 changes: 1 addition & 1 deletion viam_cartographer_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func checkPositionOutputs(
pose, err := svc.Position(context.Background())
test.That(t, err, test.ShouldBeNil)
expectedPose := spatialmath.NewPose(
r3.Vector{X: inputPose.X, Y: inputPose.Y, Z: inputPose.Z},
r3.Vector{X: inputPose.GetX(), Y: inputPose.GetY(), Z: inputPose.GetZ()},
makeQuaternionFromGenericMap(inputQuat),
)
test.That(t, pose, test.ShouldResemble, expectedPose)
Expand Down

0 comments on commit b1694ec

Please sign in to comment.