Thursday, May 2, 2024
HomeGolangEasy dependency import - Code Evaluate

Easy dependency import – Code Evaluate


Thanks for serving to me prematurely. Pretty new to programming. I’ve two dependencies and a few code first is pet:

bundle pet

func Bark() string{
return "Woof!"
}

func Barks() string {
return "Woof! Woof! Woof!"
}

github.com/dancoe77/008-puppy

Subsequent could be canine:

bundle canine

import (
	"strings"
)

func WhenGrownUp(s string) string {
	return "When the pet grows up it says: " + strings.ToUpper(s)
}

github.com/dancoe77/009-dog

Lastly there may be the code that joins the 2:

bundle fundamental

import(
	"fmt"
	"github.com/dancoe77/008-puppy"
	"github.com/dancoe77/009-dog"
)
func fundamental(){
	s1 := pet.Bark()
	s2 := pet.Barks()
	fmt.Println(s1)
	fmt.Println(s2)
	
	s3 := canine.BigBark()
	s4 := canine.BigBarks()
	fmt.Println(s3)
	fmt.Println(s4)
	
	//additionally like this
	
}

049-Modular_code_dependency_mgmt_part2

I’ve seemed this over a number of occasions and I don’t see any cyclic dependencies however after I run fundamental.go I get import cycle not allowed so I’m guessing there’s a cyclic depency someplace I’m simply not seeing it.

Dan S

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments