distro: avoid nil-pointer dereference on error

When a key is not fonud, there is no `err` variable set, so we should
not attempt to print it.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2020-03-15 13:37:59 +01:00
parent 8400b39577
commit 6309611fea
5 changed files with 10 additions and 10 deletions

View file

@ -71,7 +71,7 @@ func New(confPaths []string) (*Fedora30, error) {
repos, exists := repoMap["x86_64"]
if !exists {
log.Printf("Could not load architecture-specific repository data for x86_64 (%s): %s", r.Name(), err.Error())
log.Printf("Could not load architecture-specific repository data for x86_64 (%s)", r.Name())
} else {
r.arches["x86_64"] = arch{
Name: "x86_64",
@ -87,7 +87,7 @@ func New(confPaths []string) (*Fedora30, error) {
repos, exists = repoMap["aarch64"]
if !exists {
log.Printf("Could not load architecture-specific repository data for x86_64 (%s): %s", r.Name(), err.Error())
log.Printf("Could not load architecture-specific repository data for aarch64 (%s)", r.Name())
} else {
r.arches["aarch64"] = arch{
Name: "aarch64",

View file

@ -71,7 +71,7 @@ func New(confPaths []string) (*Fedora31, error) {
repos, exists := repoMap["x86_64"]
if !exists {
log.Printf("Could not load architecture-specific repository data for x86_64 (%s): %s", r.Name(), err.Error())
log.Printf("Could not load architecture-specific repository data for x86_64 (%s)", r.Name())
} else {
r.arches["x86_64"] = arch{
Name: "x86_64",
@ -87,7 +87,7 @@ func New(confPaths []string) (*Fedora31, error) {
repos, exists = repoMap["aarch64"]
if !exists {
log.Printf("Could not load architecture-specific repository data for x86_64 (%s): %s", r.Name(), err.Error())
log.Printf("Could not load architecture-specific repository data for aarch64 (%s)", r.Name())
} else {
r.arches["aarch64"] = arch{
Name: "aarch64",

View file

@ -71,7 +71,7 @@ func New(confPaths []string) (*Fedora32, error) {
repos, exists := repoMap["x86_64"]
if !exists {
log.Printf("Could not load architecture-specific repository data for x86_64 (%s): %s", r.Name(), err.Error())
log.Printf("Could not load architecture-specific repository data for x86_64 (%s)", r.Name())
} else {
r.arches["x86_64"] = arch{
Name: "x86_64",
@ -87,7 +87,7 @@ func New(confPaths []string) (*Fedora32, error) {
repos, exists = repoMap["aarch64"]
if !exists {
log.Printf("Could not load architecture-specific repository data for x86_64 (%s): %s", r.Name(), err.Error())
log.Printf("Could not load architecture-specific repository data for aarch64 (%s)", r.Name())
} else {
r.arches["aarch64"] = arch{
Name: "aarch64",

View file

@ -76,7 +76,7 @@ func New(confPaths []string) (*RHEL81, error) {
repos, exists := repoMap["x86_64"]
if !exists {
log.Printf("Could not load architecture-specific repository data for x86_64 (%s): %s", r.Name(), err.Error())
log.Printf("Could not load architecture-specific repository data for x86_64 (%s)", r.Name())
} else {
r.arches["x86_64"] = arch{
Name: "x86_64",
@ -92,7 +92,7 @@ func New(confPaths []string) (*RHEL81, error) {
repos, exists = repoMap["aarch64"]
if !exists {
log.Printf("Could not load architecture-specific repository data for aarch64 (%s): %s", r.Name(), err.Error())
log.Printf("Could not load architecture-specific repository data for aarch64 (%s)", r.Name())
} else {
r.arches["aarch64"] = arch{
Name: "aarch64",

View file

@ -76,7 +76,7 @@ func New(confPaths []string) (*RHEL82, error) {
repos, exists := repoMap["x86_64"]
if !exists {
log.Printf("Could not load architecture-specific repository data for x86_64 (%s): %s", r.Name(), err.Error())
log.Printf("Could not load architecture-specific repository data for x86_64 (%s)", r.Name())
} else {
r.arches["x86_64"] = arch{
Name: "x86_64",
@ -92,7 +92,7 @@ func New(confPaths []string) (*RHEL82, error) {
repos, exists = repoMap["aarch64"]
if !exists {
log.Printf("Could not load architecture-specific repository data for aarch64 (%s): %s", r.Name(), err.Error())
log.Printf("Could not load architecture-specific repository data for aarch64 (%s)", r.Name())
} else {
r.arches["aarch64"] = arch{
Name: "aarch64",