GithubHelp home page GithubHelp logo

err0r500 / go-realworld-clean Goto Github PK

View Code? Open in Web Editor NEW
504.0 16.0 82.0 258 KB

a clean architecture implementation of the realworldapp : https://github.com/gothinkster/realworld

License: MIT License

Shell 0.29% Dockerfile 0.66% Makefile 0.77% Go 98.28%
realworld-backend golang clean-architecture clean-code go example-project hexagonal-architecture ports-and-adapters testing realworld

go-realworld-clean's People

Contributors

err0r500 avatar sarathsp06 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-realworld-clean's Issues

Refactor RouterHandler.SetRoutes(r *gin.Engine)

I've selected RouterHandler.SetRoutes(r *gin.Engine) for refactoring, which is a unit of 33 lines of code. Addressing this will make our codebase more maintainable and improve Better Code Hub's Write Short Units of Code guideline rating! ๐Ÿ‘

Here's the gist of this guideline:

  • Definition ๐Ÿ“–
    Limit the length of code units to 15 lines of code.
  • Whyโ“
    Small units are easier to analyse, test and reuse.
  • How ๐Ÿ”ง
    When writing new units, don't let them grow above 15 lines of code. When a unit grows beyond this, split it in smaller units of no longer than 15 lines.

You can find more info about this guideline in Building Maintainable Software. ๐Ÿ“–


โ„น๏ธ To know how many other refactoring candidates need addressing to get a guideline compliant, select some by clicking on the ๐Ÿ”ฒ next to them. The risk profile below the candidates signals (โœ…) when it's enough! ๐Ÿ


Good luck and happy coding! :shipit: โœจ ๐Ÿ’ฏ

update this project ?

Hi,
It haven't updated this project for a long time, I think about updating this repo.
I may change the app http API at the same time (not sure anyone really cares about remaining fully compatible with the realworld app)

improve domain modelling

  • looks like generics brought union types with them, I'll try to use them to refine the model
  • improve fields validation

improve usecases

  • stop using an interactor struct playing in "god-mode" with our driven adapters
  • see if the outbox pattern is needed somewhere

improve testing

  • testing/quick to use property-based testing
  • implement a postgresql persistence (using test-containers)

use up-to-date libraries

  • not sure what changed

Any idea is welcome in the comments below ;)

Problem trying to run it

Hi, Thanks for the contribution with this project.

I am trying to run it but getting this error following the instructions

image

Wrong logic in Follow function

return i < len(user.FollowIDs) && user.FollowIDs[i] == userName

func (user User) Follows(userName string) bool {
	if user.FollowIDs == nil {
		return false
	}

	sort.Strings(user.FollowIDs)

	// The return value is the index to insert x if x is not present (it could be len(a)).
	// what happens if `i == 0` and `user.FollowIDs[i] != userName`
	i := sort.SearchStrings(user.FollowIDs, userName)

        // user.FollowIDs[i] == userName will be wrong in the case above
	return i < len(user.FollowIDs) && user.FollowIDs[i] == userName
}

make docker on intel mac os 11.4

#16 10.55 /go/pkg/mod/github.com/golang/[email protected]/gps/constraint.go:103:21: cannot use sv (type *semver.Version) as type semver.Version in field value
#16 10.55 /go/pkg/mod/github.com/golang/[email protected]/gps/constraint.go:122:16: invalid type assertion: c.(semver.Version) (non-interface type *semver.Constraints on left)
#16 10.55 /go/pkg/mod/github.com/golang/[email protected]/gps/constraint.go:149:4: undefined: semver.Constraint
------
executor failed running [/bin/sh -c go get -u github.com/golang/dep/cmd/dep]: exit code: 2```

HTTP details on interface adapters layer

Hi, thanks for example. Can you explain pls why you put http details (router for example) to interface adapters layer(implem directory)?. From reading articles on clean architecture it seems like it should be on a frameworks & drivers layer, isn't it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.