Skip to content

Commit

Permalink
Fix #49 (#57)
Browse files Browse the repository at this point in the history
Changes to `CommonApiDumpFlags` were being lost.

Also took the opportunity to properly organize our import statements.
  • Loading branch information
liujed authored Dec 11, 2024
1 parent 96cfe06 commit 959c4f4
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 37 deletions.
3 changes: 2 additions & 1 deletion apidump/health_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package apidump

import (
"fmt"
"github.com/gorilla/mux"
"net/http"

"github.com/gorilla/mux"
)

// Handles health check requests for the Docker Extension.
Expand Down
2 changes: 1 addition & 1 deletion cmd/internal/apidump/apidump.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var (
dockerExtensionMode bool
healthCheckPort int

commonApidumpFlags CommonApidumpFlags
commonApidumpFlags *CommonApidumpFlags
)

// This function will either startup apidump normally, or never return, with probability
Expand Down
6 changes: 4 additions & 2 deletions cmd/internal/apidump/common_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ type CommonApidumpFlags struct {
SendWitnessPayloads bool
}

func AddCommonApiDumpFlags(cmd *cobra.Command) (flags CommonApidumpFlags) {
func AddCommonApiDumpFlags(cmd *cobra.Command) *CommonApidumpFlags {
flags := &CommonApidumpFlags{}

cmd.Flags().StringVar(
&flags.Filter,
"filter",
Expand Down Expand Up @@ -88,7 +90,7 @@ func AddCommonApiDumpFlags(cmd *cobra.Command) (flags CommonApidumpFlags) {
return flags
}

func ConvertCommonApiDumpFlagsToArgs(flags CommonApidumpFlags) []string {
func ConvertCommonApiDumpFlagsToArgs(flags *CommonApidumpFlags) []string {
commonApidumpArgs := []string{}

if flags.Filter != "" {
Expand Down
2 changes: 1 addition & 1 deletion cmd/internal/ec2/ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
var (
// Postman Insights project id
projectID string
apidumpFlags apidump.CommonApidumpFlags
apidumpFlags *apidump.CommonApidumpFlags

// Overwrite the existing service file and don't prompt the user
forceOverwrite bool
Expand Down
2 changes: 1 addition & 1 deletion cmd/internal/ecs/ecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var (

// apidump flags
// These flags will be passed to apidump command in task definition file
apidumpFlags apidump.CommonApidumpFlags
apidumpFlags *apidump.CommonApidumpFlags
)

var Cmd = &cobra.Command{
Expand Down
1 change: 1 addition & 0 deletions cmd/internal/kube/injector/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package injector

import (
"bytes"

v1 "k8s.io/api/core/v1"
kyaml "sigs.k8s.io/yaml"
)
Expand Down
3 changes: 2 additions & 1 deletion cmd/internal/kube/injector/injector_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package injector

import (
"testing"

"github.com/stretchr/testify/assert"
appsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"testing"
)

func Test_Inject(t *testing.T) {
Expand Down
8 changes: 3 additions & 5 deletions cmd/internal/kube/print_fragment.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ import (
"fmt"
"strings"

"github.com/hashicorp/hcl/v2/hclsyntax"
"github.com/hashicorp/hcl/v2/hclwrite"
"github.com/postmanlabs/postman-insights-agent/cfg"
"github.com/postmanlabs/postman-insights-agent/cmd/internal/cmderr"
"github.com/postmanlabs/postman-insights-agent/rest"
v1 "k8s.io/api/core/v1"

"github.com/spf13/cobra"
"github.com/zclconf/go-cty/cty"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/yaml"

"github.com/hashicorp/hcl/v2/hclsyntax"
"github.com/hashicorp/hcl/v2/hclwrite"
)

var printHelmChartFragmentCmd = &cobra.Command{
Expand Down
5 changes: 2 additions & 3 deletions learn/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ package learn
import (
"strconv"

"github.com/google/uuid"

"github.com/akitasoftware/akita-libs/akid"
pb "github.com/akitasoftware/akita-ir/go/api_spec"
"github.com/akitasoftware/akita-libs/akid"
"github.com/google/uuid"
)

var (
Expand Down
7 changes: 3 additions & 4 deletions learn/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ import (
"net/http"
"net/url"

"github.com/golang/protobuf/proto"
"github.com/google/go-cmp/cmp"
"github.com/pkg/errors"

as "github.com/akitasoftware/akita-ir/go/api_spec"
pb "github.com/akitasoftware/akita-ir/go/api_spec"
"github.com/akitasoftware/akita-libs/akinet"
"github.com/akitasoftware/akita-libs/memview"
"github.com/akitasoftware/akita-libs/pbhash"
"github.com/akitasoftware/akita-libs/spec_util"
"github.com/golang/protobuf/proto"
"github.com/google/go-cmp/cmp"
"github.com/pkg/errors"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions location/location.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package location

import (
"github.com/pkg/errors"

"github.com/akitasoftware/akita-libs/akiuri"
"github.com/pkg/errors"
)

// Implements pflag.Value interface.
Expand Down
5 changes: 2 additions & 3 deletions pcap/net_parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import (
"testing"
"time"

"github.com/google/go-cmp/cmp"
"github.com/google/gopacket"

"github.com/akitasoftware/akita-libs/akinet"
"github.com/akitasoftware/akita-libs/akinet/http"
"github.com/akitasoftware/akita-libs/buffer_pool"
"github.com/google/go-cmp/cmp"
"github.com/google/gopacket"
)

var (
Expand Down
9 changes: 4 additions & 5 deletions pcap/pcap_replay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@ import (
"testing"
"time"

"github.com/akitasoftware/akita-libs/akinet"
akihttp "github.com/akitasoftware/akita-libs/akinet/http"
"github.com/akitasoftware/akita-libs/buffer_pool"
"github.com/akitasoftware/akita-libs/memview"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/google/gopacket"
_ "github.com/google/gopacket/layers"
"github.com/google/gopacket/pcap"
"github.com/google/uuid"
"github.com/pkg/errors"

"github.com/akitasoftware/akita-libs/akinet"
akihttp "github.com/akitasoftware/akita-libs/akinet/http"
"github.com/akitasoftware/akita-libs/buffer_pool"
"github.com/akitasoftware/akita-libs/memview"
)

// Constants wrapped as functions because we can't read the testdata file at
Expand Down
5 changes: 2 additions & 3 deletions pcap/stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import (
"testing"
"time"

"github.com/akitasoftware/akita-libs/akinet"
"github.com/akitasoftware/akita-libs/memview"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"github.com/google/gopacket/reassembly"
"github.com/google/uuid"

"github.com/akitasoftware/akita-libs/akinet"
"github.com/akitasoftware/akita-libs/memview"
)

var (
Expand Down
5 changes: 2 additions & 3 deletions pcap/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ import (
"strconv"
"strings"

"github.com/akitasoftware/akita-libs/akinet"
"github.com/akitasoftware/akita-libs/memview"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/google/gopacket"
"github.com/google/gopacket/reassembly"

"github.com/akitasoftware/akita-libs/akinet"
"github.com/akitasoftware/akita-libs/memview"
)

var (
Expand Down
3 changes: 1 addition & 2 deletions rest/base_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ import (
"os"
"sync"

"github.com/akitasoftware/akita-libs/akid"
"github.com/pkg/errors"
"github.com/spf13/viper"

"github.com/akitasoftware/akita-libs/akid"
)

// Use a proxy, "" is none. (This is because the flags package doesn't support Optional)
Expand Down

0 comments on commit 959c4f4

Please sign in to comment.