Skip to content

Comments

Move to internal package#874

Merged
stephanos merged 7 commits intotemporalio:mainfrom
stephanos:cliext-pkg
Nov 18, 2025
Merged

Move to internal package#874
stephanos merged 7 commits intotemporalio:mainfrom
stephanos:cliext-pkg

Conversation

@stephanos
Copy link
Contributor

@stephanos stephanos commented Nov 14, 2025

What was changed

Before

/temporalcli
  /internal
     /cmd
     /...
  commands.go

After

/internal
  /cmd
  /temporalcli
     /...
     commands.go

Also see the related temporalio/documentation#3997.

Why?

We want to establish a cliext that will contain the shared code for writing CLI extensions.

The existing github.com/temporalio/cli/temporalcli package should not be used and may be moved to internal as part of this project.

Checklist

  1. Closes

  2. How was this tested:

  1. Any docs updates needed?

@stephanos stephanos force-pushed the cliext-pkg branch 5 times, most recently from 32bcc49 to 4123f00 Compare November 14, 2025 18:43
@stephanos stephanos changed the title cliext package Move to internal package Nov 14, 2025
@stephanos stephanos force-pushed the cliext-pkg branch 7 times, most recently from 134b77c to f288099 Compare November 14, 2025 19:33
@stephanos stephanos force-pushed the cliext-pkg branch 2 times, most recently from fdcc385 to 568ce4f Compare November 14, 2025 20:17
- name: Check import formatting
if: ${{ matrix.checkGenCodeTarget }}
run: |
make fmt-imports
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this alongside goimports dependency and Makefile to ensure proper import formatting.

@stephanos stephanos marked this pull request as ready for review November 14, 2025 21:13
@stephanos stephanos requested review from a team as code owners November 14, 2025 21:13
@stephanos stephanos requested a review from cretz November 14, 2025 21:13
Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, added a few comments that are not that important

- name: Check import formatting
if: ${{ matrix.checkGenCodeTarget }}
run: |
make fmt-imports
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use a makefile instead of inlining this single line like we do everywhere else in this GH workflow?

Copy link
Contributor Author

@stephanos stephanos Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line is

go run golang.org/x/tools/cmd/goimports -local github.com/temporalio/cli -w .

I'd prefer to not copy that as it contains a minor element of configuration (-local) that can go out of sync/get lost.

Also, I'd actually like any other instructions to also use the Makefile where possible to have a single source of truth. I believe CIs should as much as possible use scripts/Makefiles to ensure the local experience is as close as possible to the CI experience. Commands that are only run in CI have a tendency to break more easily in my experience. Having said that, I'm not planning to make any changes right now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we using the -local flag? I thought we voted against that in the server repo because most IDEs default to not using this mode.

Also don't understand why we need a Makefile for three trivial commands.

Copy link
Member

@cretz cretz Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to not copy that as it contains a minor element of configuration (-local) that can go out of sync/get lost.

Why does it have to be in Makefile at all? Is this something we expect anything but CI to run? IMO we shouldn't pick platform favorites for our contributors (though I know we have with server, we traditionally have not with SDKs or CI). All things needed to contribute to this software should be platform independent IMO. The Makefile in this repository is only for optional things a user may want, it is not used in CI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright guys; I'll roll it back.

Copy link
Member

@cretz cretz Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concur w/ @bergundy, -local seems like a very Temporal-specific kind of option. I think we should use default formatting options. Even if we did want this option, would not recommend using this PR to do it. You should separate the moving PRs from the file mutating ones as much as you can IMO.

Copy link
Contributor Author

@stephanos stephanos Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intent was to have consistent import style (newline vs no inline); and this PR seemed like the perfect place for it since it already touches all the inconsistent import lines. Since this is now consistent, too, it's all good now.

Copy link
Member

@cretz cretz Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this new top-level file necessary? We already do a bad job of cluttering the top-level with platform/environment-specific things that continue to push the README below the fold (it was clearer back in https://github.com/temporalio/cli/tree/v0.12.0, thought arguably even Dockerfile should go). Can this be somewhere else? Or even better, installed and run as needed instead of depended on as part of the project?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 There are a couple of ways to do this with various tradeoffs. I moved the install into the Makefile target now.

Copy link
Member

@cretz cretz Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mentioned in other comment, but Makefile in this repository has been for optional things, not things that are required to be executed by CI or contributors. Makefiles are usually platform dependent and have never been used in CI or required by contributors for that reason.

Regardless, this file not being at the top level does alleviate my concerns, all good here.

Copy link
Member

@cretz cretz Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend the moving all of these files one deeper into internal, e.g. internal/temporalcli instead of just internal, but it's not a big deal.

Copy link
Contributor Author

@stephanos stephanos Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems redundant to me since the path is already github.com/temporalio/cli/internal/ with temporalio/cli right there. What's the benefit?

Copy link
Member

@cretz cretz Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Today we have everything under temporalcli because we need everything in one top-level package for visibility/clarity source code organization reasons and it was clearly named. However, now we have internal, it is unclear what should be put in the package. It'll just become a catch-all I fear (granted the existing one kinda was, but at least it was named).

But this is not a big deal to me, I'm ok w/ it like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Makes sense; I'll add it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, most things you read from https://go.dev/doc/modules/layout have sub-packages of internal, not in internal itself. I admit I have not really seen internal used as a package in itself. But not a big deal, even if a bit strange.

"google.golang.org/protobuf/types/known/durationpb"
"google.golang.org/protobuf/types/known/fieldmaskpb"

"github.com/temporalio/cli/internal/printer"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this on it's own line? Is that the fmt-import added in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup; goimports -local will sort like this

import (
  // stdlib

  // third-party

  // local packages
)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I am not a fan of -local. Why is goimports default unacceptable? Ideally we should work with default formatting options.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's gone, so let's move on.

@stephanos stephanos merged commit 959f910 into temporalio:main Nov 18, 2025
8 checks passed
@stephanos stephanos deleted the cliext-pkg branch November 18, 2025 00:15
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.

4 participants