package main

type LoggingConfig struct {
	ProjectID       string						`json:"project_id"`
	LogName		      string						`json:"log_name"`
	Type            string            `json:"type"`
	Labels          map[string]string `json:"labels"`
}

func (c *LoggingConfig) setup() *ConfigError {
	if c.ProjectID == "" {
		return &ConfigError{Name: "project_id", Message: "is required"}
	}
	if c.LogName == "" {
		return &ConfigError{Name: "log_name", Message: "is required"}
	}
	if c.Type == "" {
		return &ConfigError{Name: "type", Message: "is required"}
	}
	if c.Labels == nil {
		return &ConfigError{Name: "labels", Message: "are required"}
	}
	return nil
}

package main

type LoggingConfig struct {
	ProjectID       string						`json:"project_id"`
	LogName		      string						`json:"log_name"`
	Type            string            `json:"type"`
	Labels          map[string]string `json:"labels"`
}

func (c *LoggingConfig) setup() *ConfigError {
	for name, blank := range map[string]bool {
		"project_id": c.ProjectID == "",
		"log_name": c.LogName == "",
		"type": c.Type == "",
		"labels": c.Labels == nil,
	}{
		if blank {
			return &ConfigError{Name: name, Message: "is required"}
		}
	}
	return nil
}

Use map to remove duplications
:recycle: Use map to remove duplications
