Skip to content

Commit

Permalink
Fix Golang output to appease Golint (#34)
Browse files Browse the repository at this point in the history
- Change package name must be lowercase, not mixed case.
- Change CanDeviceId and CanMsgId to CanDeviceID and CanMsgID.
- Add comments for CanDeviceId and CanMsgID.
- Add note about automating the process of copying the file to telemetry server.
  • Loading branch information
aaronhktan authored Mar 24, 2019
1 parent d180d9a commit 45fc6e3
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions templates/can_msg_defs.mako.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
<%namespace name="helpers" file="/helpers/helpers.mako" /> \
<% from data import NUM_CAN_MESSAGES, NUM_CAN_DEVICES, parse_can_device_enum, parse_can_message_enum, parse_can_frames %> \
package CanMsgDefs
package canmsgdefs

// NOTE: This file is generated by codegen-tooling.
// Currently, this file is copy-pasted from codegen output
// to canmsgdefs in the telemetry server.

// TODO: Automate this process.

// CanDeviceID is a 16-bit integer for the source of a CAN message
type CanDeviceId uint16

// CanMsgID is a 32-bit integer for the type of CAN message
type CanMsgId uint32

// For setting the CAN device
const (
<% can_devices = parse_can_device_enum() %> \
${helpers.generate_enum_go(can_devices, 'SystemCanDevice', 'CanDeviceId')}
${helpers.generate_enum_go(can_devices, 'SystemCanDevice', 'CanDeviceID')}
)

// For setting the CAN message ID
const (
<% can_messages = parse_can_message_enum(options.filename) %> \
${helpers.generate_enum_go(can_messages, 'SystemCanMessage', 'CanMsgId')}
${helpers.generate_enum_go(can_messages, 'SystemCanMessage', 'CanMsgID')}
)

0 comments on commit 45fc6e3

Please sign in to comment.