Skip to content

Should default struct literals be excluded? #23

Closed

Description

@HakShak
var (
   defaultOptions = options{explode:false}
)

Activity

  1. changed the title [-]Should default struct initializers be excluded?[/-] [+]Should default struct literals be excluded?[/+] on Apr 11, 2021
  2. leighmcculloch commented on Apr 12, 2021

    @leighmcculloch
    Owner

    Package vars like the one you demonstrated cause this linter to error because they're a vector to side-effects either when the package modifies the value or an external package does.

    I assume you're asking because you're trying to define a package level variable for this.

    Instead define a function that returns the value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions