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

fix(message): Update Flag Iota #270

Merged
merged 1 commit into from
Oct 28, 2024
Merged

Conversation

jshlbrd
Copy link
Collaborator

@jshlbrd jshlbrd commented Oct 28, 2024

Description

  • Changes the message package's Flag starting number.

Motivation and Context

This guidance may be outdated because the iota starts at 1 without requiring addition. This small program shows that IsControl (1) works as expected (does not start at zero):

package main

import (
	"fmt"

	"github.com/brexhq/substation/v2/message"
)

func main() {
	msg := message.New()
	fmt.Println("msg flag 0, ", msg.HasFlag(0))
	fmt.Println("msg flag 1, ", msg.HasFlag(1))

	ctrl := msg.AsControl()
	fmt.Println("ctrl flag 0, ", ctrl.HasFlag(0))
	fmt.Println("ctrl flag 1, ", ctrl.HasFlag(1))
}
msg flag 0,  false
msg flag 1,  false
ctrl flag 0,  false
ctrl flag 1,  true

How Has This Been Tested?

See program above.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@jshlbrd jshlbrd marked this pull request as ready for review October 28, 2024 14:23
@jshlbrd jshlbrd requested a review from a team as a code owner October 28, 2024 14:23
@jshlbrd jshlbrd merged commit 1f43c15 into main Oct 28, 2024
7 checks passed
@jshlbrd jshlbrd deleted the jshlbrd/fix/message-flag-iota branch October 28, 2024 15:00
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.

2 participants