Skip to content

Feature Request: Discover build inputs automatically for Go apps based on imports #337

@alexrudd

Description

@alexrudd

Hello,

I work in quite a large monorepo with many main funcs and shared packages. Figuring out if a Go app needs to be rebuilt is a bit of a pain and generally something I've found most build tools to be missing.

Bazel solves this by creating build files for every package in a repo and explicitly defining the dependencies between these packages (This is automated using Gazelle). I find this to be a bit messy and overly complicated.

It seems like in Bob I would manually list the directories of all module packages that a particular build needs to get this same behaviour?

There are tools that have been created (tainted, gta) that can determine for any package if its dependencies have changed (by crawling all imports). Point such a tool at a main package and it can tell whether that app needs to be rebuilt.

Would native support for such a capability be something that could be considered for Bob? I would imagine it would have to be a special kind of input:

build:
  my app:
    input: |-
      gopackage:cmd/myapp
    cmd: |-
      go build cmd/myapp

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions