Skip to content
/ goIntf Public

example code to demostrate the usage of interfaces to avoid import cycle among different packages in go.

Notifications You must be signed in to change notification settings

m-rit/goIntf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Project: Avoiding Cyclic Imports

This project demonstrates how to avoid cyclic imports in a Go project by using interfaces. Cyclic imports occur when two or more packages directly or indirectly import each other, causing compilation errors and making code maintenance challenging. By using interfaces, we can decouple packages and break cyclic dependencies.

Project Structure

The project consists of two packages:

  1. Species: Contains functionalities related to species.
  2. Tag: Handles tag generation for different species .

How It Works

In the package tag, we create a struct that holds an instance of the species interface to handle tag related methods.

About

example code to demostrate the usage of interfaces to avoid import cycle among different packages in go.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages