Skip to content

Commit

Permalink
feat: restructure cmd folder
Browse files Browse the repository at this point in the history
Dividing the cmd folder structure into exp and core commands. Commands
that are within the exp folder are not tested 'at all' - and we most
likely do not have the infrastructure to test it. Commands in the core
folder have a better chance to get tested.

Signed-off-by: Christian Walter <[email protected]>
  • Loading branch information
walterchris committed Mar 23, 2024
1 parent 8e176a0 commit 4fbe684
Show file tree
Hide file tree
Showing 42 changed files with 27 additions and 27 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Build txt-suite
run: go build -ldflags '-X main.gitcommit=${GITHUB_SHA} -X main.gittag=${github.ref_name} -w -extldflags "-static"' -o txt-suite cmd/txt-suite/*.go
run: go build -ldflags '-X main.gitcommit=${GITHUB_SHA} -X main.gittag=${github.ref_name} -w -extldflags "-static"' -o txt-suite cmd/core/txt-suite/*.go
- name: Build txt-prov
run: go build -ldflags '-X main.gitcommit=${GITHUB_SHA} -X main.gittag=${github.ref_name} -w -extldflags "-static"' -o txt-prov cmd/txt-prov/*.go
run: go build -ldflags '-X main.gitcommit=${GITHUB_SHA} -X main.gittag=${github.ref_name} -w -extldflags "-static"' -o txt-prov cmd/core/txt-prov/*.go
- name: Build bg-suite
run: go build -ldflags '-X main.gitcommit=${GITHUB_SHA} -X main.gittag=${github.ref_name} -w -extldflags "-static"' -o bg-suite cmd/bg-suite/*.go
run: go build -ldflags '-X main.gitcommit=${GITHUB_SHA} -X main.gittag=${github.ref_name} -w -extldflags "-static"' -o bg-suite cmd/core/bg-suite/*.go
- name: Build bg-prov
run: go build -ldflags '-X main.gitcommit=${GITHUB_SHA} -X main.gittag=${github.ref_name} -w -extldflags "-static"' -o bg-prov cmd/bg-prov/*.go
run: go build -ldflags '-X main.gitcommit=${GITHUB_SHA} -X main.gittag=${github.ref_name} -w -extldflags "-static"' -o bg-prov cmd/core/bg-prov/*.go
- name: Build pcr0tool
run: go build -ldflags '-X main.gitcommit=${GITHUB_SHA} -X main.gittag=${github.ref_name} -w -extldflags "-static"' -o pcr0tool cmd/pcr0tool/*.go
run: go build -ldflags '-X main.gitcommit=${GITHUB_SHA} -X main.gittag=${github.ref_name} -w -extldflags "-static"' -o pcr0tool cmd/exp/pcr0tool/*.go
- name: Build amd-suite
run: go build -ldflags '-X main.gitcommit=${GITHUB_SHA} -X main.gittag=${github.ref_name} -w -extldflags "-static"' -o amd-suite cmd/amd-suite/*.go
run: go build -ldflags '-X main.gitcommit=${GITHUB_SHA} -X main.gittag=${github.ref_name} -w -extldflags "-static"' -o amd-suite cmd/exp/amd-suite/*.go
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"hash"
"os"

"github.com/9elements/converged-security-suite/v2/cmd/pcr0tool/commands"
"github.com/9elements/converged-security-suite/v2/cmd/pcr0tool/commands/dumpregisters/helpers"
"github.com/9elements/converged-security-suite/v2/cmd/exp/pcr0tool/commands"
"github.com/9elements/converged-security-suite/v2/cmd/exp/pcr0tool/commands/dumpregisters/helpers"
"github.com/9elements/converged-security-suite/v2/pkg/bootflow/actions/tpmactions"
"github.com/9elements/converged-security-suite/v2/pkg/bootflow/bootengine"
"github.com/9elements/converged-security-suite/v2/pkg/bootflow/datasources"
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
pkgbytes "github.com/linuxboot/fiano/pkg/bytes"
fianoUEFI "github.com/linuxboot/fiano/pkg/uefi"

"github.com/9elements/converged-security-suite/v2/cmd/pcr0tool/commands"
"github.com/9elements/converged-security-suite/v2/cmd/pcr0tool/commands/diff/format"
"github.com/9elements/converged-security-suite/v2/cmd/pcr0tool/commands/dumpregisters/helpers"
"github.com/9elements/converged-security-suite/v2/cmd/exp/pcr0tool/commands"
"github.com/9elements/converged-security-suite/v2/cmd/exp/pcr0tool/commands/diff/format"
"github.com/9elements/converged-security-suite/v2/cmd/exp/pcr0tool/commands/dumpregisters/helpers"
"github.com/9elements/converged-security-suite/v2/pkg/bootflow/bootengine"
"github.com/9elements/converged-security-suite/v2/pkg/bootflow/flows"
bfformat "github.com/9elements/converged-security-suite/v2/pkg/bootflow/lib/format"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"os"

"github.com/9elements/converged-security-suite/v2/cmd/pcr0tool/commands/displayeventlog/format"
"github.com/9elements/converged-security-suite/v2/cmd/exp/pcr0tool/commands/displayeventlog/format"
"github.com/9elements/converged-security-suite/v2/pkg/bootflow/subsystems/trustchains/tpm/pcr"
"github.com/9elements/converged-security-suite/v2/pkg/tpmeventlog"
)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"os"

"github.com/9elements/converged-security-suite/v2/cmd/pcr0tool/commands/dumpregisters/helpers"
"github.com/9elements/converged-security-suite/v2/cmd/exp/pcr0tool/commands/dumpregisters/helpers"
"github.com/9elements/converged-security-suite/v2/pkg/registers"

"gopkg.in/yaml.v3"
Expand Down Expand Up @@ -70,7 +70,7 @@ func (cmd Command) Execute(ctx context.Context, args []string) {
if err != nil {
panic(fmt.Sprintf("failed to marshal registers into json, err: %v", err))
}
err = os.WriteFile(*cmd.outputFile, b, 0666)
err = os.WriteFile(*cmd.outputFile, b, 0o666)
if err != nil {
panic(fmt.Sprintf("failed to write data to file %s, err: %v", *cmd.outputFile, err))
}
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"os"
"strings"

"github.com/9elements/converged-security-suite/v2/cmd/pcr0tool/commands"
"github.com/9elements/converged-security-suite/v2/cmd/pcr0tool/commands/dumpregisters/helpers"
"github.com/9elements/converged-security-suite/v2/cmd/exp/pcr0tool/commands"
"github.com/9elements/converged-security-suite/v2/cmd/exp/pcr0tool/commands/dumpregisters/helpers"
"github.com/9elements/converged-security-suite/v2/pkg/bootflow/bootengine"
"github.com/9elements/converged-security-suite/v2/pkg/bootflow/flows"
"github.com/9elements/converged-security-suite/v2/pkg/bootflow/lib/format"
Expand Down
22 changes: 11 additions & 11 deletions cmd/pcr0tool/main.go → cmd/exp/pcr0tool/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import (
"os"
"sort"

"github.com/9elements/converged-security-suite/v2/cmd/pcr0tool/commands"
bruteforceacmpolicystatus "github.com/9elements/converged-security-suite/v2/cmd/pcr0tool/commands/bruteforce_acm_policy_status"
"github.com/9elements/converged-security-suite/v2/cmd/pcr0tool/commands/diff"
"github.com/9elements/converged-security-suite/v2/cmd/pcr0tool/commands/displayeventlog"
"github.com/9elements/converged-security-suite/v2/cmd/pcr0tool/commands/displayfwinfo"
"github.com/9elements/converged-security-suite/v2/cmd/pcr0tool/commands/dumpfit"
"github.com/9elements/converged-security-suite/v2/cmd/pcr0tool/commands/dumpregisters"
"github.com/9elements/converged-security-suite/v2/cmd/pcr0tool/commands/pcrread"
"github.com/9elements/converged-security-suite/v2/cmd/pcr0tool/commands/printnodes"
"github.com/9elements/converged-security-suite/v2/cmd/pcr0tool/commands/sum"
validatesecurity "github.com/9elements/converged-security-suite/v2/cmd/pcr0tool/commands/validate_security"
"github.com/9elements/converged-security-suite/v2/cmd/exp/pcr0tool/commands"
bruteforceacmpolicystatus "github.com/9elements/converged-security-suite/v2/cmd/exp/pcr0tool/commands/bruteforce_acm_policy_status"
"github.com/9elements/converged-security-suite/v2/cmd/exp/pcr0tool/commands/diff"
"github.com/9elements/converged-security-suite/v2/cmd/exp/pcr0tool/commands/displayeventlog"
"github.com/9elements/converged-security-suite/v2/cmd/exp/pcr0tool/commands/displayfwinfo"
"github.com/9elements/converged-security-suite/v2/cmd/exp/pcr0tool/commands/dumpfit"
"github.com/9elements/converged-security-suite/v2/cmd/exp/pcr0tool/commands/dumpregisters"
"github.com/9elements/converged-security-suite/v2/cmd/exp/pcr0tool/commands/pcrread"
"github.com/9elements/converged-security-suite/v2/cmd/exp/pcr0tool/commands/printnodes"
"github.com/9elements/converged-security-suite/v2/cmd/exp/pcr0tool/commands/sum"
validatesecurity "github.com/9elements/converged-security-suite/v2/cmd/exp/pcr0tool/commands/validate_security"
"github.com/9elements/converged-security-suite/v2/pkg/log"
"github.com/facebookincubator/go-belt/tool/logger"
"github.com/facebookincubator/go-belt/tool/logger/implementation/logrus"
Expand Down

0 comments on commit 4fbe684

Please sign in to comment.