Cleaned up a few comments and strings

This commit is contained in:
shaggygi 2019-11-30 19:05:33 -05:00
parent 24557c2465
commit 7f5fdf176c
15 changed files with 28 additions and 28 deletions

View File

@ -19,7 +19,7 @@ var publishPayload string
var PublishCmd = &cobra.Command{
Use: "publish",
Short: "publish an event to multiple consumers",
Short: "Publish an event to multiple consumers",
Run: func(cmd *cobra.Command, args []string) {
err := publish.PublishTopic(publishTopic, publishPayload)
if err != nil {

View File

@ -5,7 +5,7 @@
package api
// RuntimeAPIVersion represents the version for the Dapr runtime API
// RuntimeAPIVersion represents the version for the Dapr runtime API.
var (
RuntimeAPIVersion = "1.0"
)

View File

@ -16,7 +16,7 @@ import (
"github.com/dapr/cli/pkg/standalone"
)
// InvokeApp is used to invoke the application
// InvokeApp invokes the application.
func InvokeApp(appID, method, payload string) (string, error) {
list, err := standalone.List()
if err != nil {
@ -43,5 +43,5 @@ func InvokeApp(appID, method, payload string) (string, error) {
}
}
return "", fmt.Errorf("App ID %s not found", appID)
return "", fmt.Errorf("App ID %s not found.", appID)
}

View File

@ -15,7 +15,7 @@ import (
"k8s.io/client-go/tools/clientcmd"
)
// Client returns a new Kubernetes client
// Client returns a new Kubernetes client.
func Client() (*k8s.Clientset, error) {
var kubeconfig *string
if home := homeDir(); home != "" {

View File

@ -20,11 +20,11 @@ import (
const daprManifestPath = "https://daprreleases.blob.core.windows.net/manifest/dapr-operator.yaml"
// Initialize to deploy the Dapr operator
// Initialize deploys the Dapr operator.
func Init() error {
kubeExists := kubeconfigExists()
if !kubeExists {
return errors.New("Can't connect to a Kubernetes cluster. Make sure you have the Kubernetes config file on your machine")
return errors.New("Can't connect to a Kubernetes cluster. Make sure you have the Kubernetes config file on your machine.")
}
msg := "Deploying the Dapr Operator to your cluster..."

View File

@ -11,7 +11,7 @@ import (
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// ListOutput to represent the application id, application port and creation time
// ListOutput represents the application ID, application port and creation time.
type ListOutput struct {
AppID string `csv:"APP ID"`
AppPort string `csv:"APP PORT"`
@ -19,7 +19,7 @@ type ListOutput struct {
Created string `csv:"CREATED"`
}
// List to output all the the applications
// List outputs all the applications.
func List() ([]ListOutput, error) {
client, err := Client()
if err != nil {

View File

@ -5,7 +5,7 @@
package kubernetes
// RunConfig to represent application configuration parameters
// RunConfig represents the application configuration parameters.
type RunConfig struct {
AppID string
AppPort int
@ -16,12 +16,12 @@ type RunConfig struct {
Image string
}
// RunOutput to represent the run output
// RunOutput represents the run output.
type RunOutput struct {
Message string
}
// Run based on run configuration
// Run executes the application based on the run configuration.
func Run(config *RunConfig) (*RunOutput, error) {
return nil, nil
}

View File

@ -11,11 +11,11 @@ import (
"github.com/dapr/cli/utils"
)
// Uninstall the Dapr
// Uninstall removes Dapr.
func Uninstall() error {
err := utils.RunCmdAndWait("kubectl", "delete", "-f", daprManifestPath)
if err != nil {
return errors.New("Is Dapr running? Please note uninstall does not remove Dapr when installed via Helm")
return errors.New("Is Dapr running? Please note uninstall does not remove Dapr when installed via Helm.")
}
return nil
}

View File

@ -23,7 +23,7 @@ var (
WhiteBold = color.New(color.FgWhite, color.Bold).SprintFunc()
)
// SuccessStatusEvent to report on success event
// SuccessStatusEvent reports on a success event.
func SuccessStatusEvent(w io.Writer, fmtstr string, a ...interface{}) {
if runtime.GOOS == "windows" {
fmt.Fprintf(w, "%s\n", fmt.Sprintf(fmtstr, a...))
@ -32,7 +32,7 @@ func SuccessStatusEvent(w io.Writer, fmtstr string, a ...interface{}) {
}
}
// FailureStatusEvent to report on failure event
// FailureStatusEvent reports on a failure event.
func FailureStatusEvent(w io.Writer, fmtstr string, a ...interface{}) {
if runtime.GOOS == "windows" {
fmt.Fprintf(w, "%s\n", fmt.Sprintf(fmtstr, a...))
@ -41,7 +41,7 @@ func FailureStatusEvent(w io.Writer, fmtstr string, a ...interface{}) {
}
}
// PendingStatusEvent to report on pending event
// PendingStatusEvent reports on a pending event.
func PendingStatusEvent(w io.Writer, fmtstr string, a ...interface{}) {
if runtime.GOOS == "windows" {
fmt.Fprintf(w, "%s\n", fmt.Sprintf(fmtstr, a...))
@ -50,7 +50,7 @@ func PendingStatusEvent(w io.Writer, fmtstr string, a ...interface{}) {
}
}
// InfoStatusEvent for status information on event
// InfoStatusEvent reports status information on an event.
func InfoStatusEvent(w io.Writer, fmtstr string, a ...interface{}) {
if runtime.GOOS == "windows" {
fmt.Fprintf(w, "%s\n", fmt.Sprintf(fmtstr, a...))

View File

@ -15,7 +15,7 @@ import (
"github.com/dapr/cli/pkg/standalone"
)
// PublishTopic is used to publish topic
// PublishTopic publishes the topic.
func PublishTopic(topic, payload string) error {
if topic == "" {
return errors.New("topic is missing")

View File

@ -12,7 +12,7 @@ import (
ps "github.com/mitchellh/go-ps"
)
// ListOutput to represent the application id, application port and creation time
// ListOutput represents the application ID, application port and creation time.
type ListOutput struct {
AppID string `csv:"APP ID"`
HTTPPort int `csv:"HTTP PORT"`
@ -24,7 +24,7 @@ type ListOutput struct {
PID int
}
// List to output all the the applications
// List outputs all the applications.
func List() ([]ListOutput, error) {
list := []ListOutput{}

View File

@ -31,7 +31,7 @@ const (
redisStateStoreYamlFileName = "redis.yaml"
)
// RunConfig to represent application configuration parameters
// RunConfig represents the application configuration parameters.
type RunConfig struct {
AppID string
AppPort int
@ -48,7 +48,7 @@ type RunConfig struct {
PlacementHost string
}
// RunOutput to represent the run output
// RunOutput represents the run output.
type RunOutput struct {
DaprCMD *exec.Cmd
DaprHTTPPort int

View File

@ -47,7 +47,7 @@ const (
daprDefaultWindowsInstallPath = "c:\\dapr"
)
// Init installs Dapr on a local machine using the supplied runtimeVersion
// Init installs Dapr on a local machine using the supplied runtimeVersion.
func Init(runtimeVersion string, dockerNetwork string, installLocation string) error {
dockerInstalled := isDockerInstalled()
if !dockerInstalled {
@ -137,8 +137,8 @@ func getDaprDir() (string, error) {
return p, nil
}
// installLocation is not used, but it is present because it's required to fit the initSteps func above. If the number of args
// increases more, we may consider passing in a struct instead of individual args.
// installLocation is not used, but it is present because it's required to fit the initSteps func above.
// If the number of args increases more, we may consider passing in a struct instead of individual args.
func runRedis(wg *sync.WaitGroup, errorChan chan<- error, dir, version string, dockerNetwork string, installLocation string) {
defer wg.Done()

View File

@ -12,7 +12,7 @@ import (
"github.com/dapr/cli/utils"
)
// Terminate the application process
// Stop terminates the application process.
func Stop(appID string) error {
apps, err := List()
if err != nil {

View File

@ -10,7 +10,7 @@ import (
"runtime"
)
// GetRuntimeVersion returns the version for the local Dapr runtime
// GetRuntimeVersion returns the version for the local Dapr runtime.
func GetRuntimeVersion() string {
runtimeName := ""
if runtime.GOOS == "windows" {