Assume the state is the config struct and each implementation is reading it
from s different file type (yaml, toml, hlc, json, etc).
On Friday, April 27, 2018 at 4:45:33 AM UTC+4:30, Jake Montgomery wrote:
>
> The example gives me a better understanding of what you are doing, though
> still not
The example gives me a better understanding of what you are doing, though
still not much understanding as to *why *you are doing it this way.
Usually, if I feel that code has a "smell" in Go, there is a way to rethink
the basic design resulting more "natural" code. But without a full
understand
In the process of answering your questions I realised there was a number of
changes I needed to make to my code, here is the state of it at the commit
I just made with this in mind: (this is a permalink and shows how it is at
this exact
stage)
https://github.com/calibrae-project/bast/tree/418a
I looked at the OP again and I have created a struct embedding with
interface type for a similar purpose as you have in mind.
I'm not sure how to condense it exactly, but I'll just explain the salient
points:
1. The data has to be referred to via an interface{} which you load with
a st
Thanks @Louki,
The names are absolutely made up and are just for the purpose of
demonstration.
The problem is the package state, one whole package to just hold a type.
On Tuesday, April 24, 2018 at 10:36:29 AM UTC+4:30, Louki Sumirniy wrote:
>
> The name could use some work, stutter is a no-no
The name could use some work, stutter is a no-no in Go. What kind of state
does it hold? User profiles? MMO game world database? Is your scope too
broad? I see that it looks like a geography database, so it would make more
sense to call it 'geo' or something like this. Also, for such a database
@Jake @Bryan Thanks!
Current solution I use:
A package that holds the shared data type State:
package state
type State struct {
Latitude float64
Longitude float64
Mark string
Name string
// ...
}
Three packages with different implementations and algorithms:
pack
I agree with Jake: a more complete example would be helpful. In my
experience, this sort of issue is often a symptom of awkward package
boundaries. If you can find a more natural package boundary, you may be
able to sidestep the problem.
(There are certainly some cases where the lack of covaria
My gut feeling is that there is an elegant way to achieve what you want.
Unfortunately, I am having trouble following the code you are describing,
and more importantly, what you are actually trying to accomplish. Perhaps
it is my failing.
If you would post a more complete example, showing the
The State type is just a POGO with no methods. The part that changes is the
implementation of Clone() (State, error) method.
On Sunday, April 22, 2018 at 5:18:00 AM UTC+4:30, Louki Sumirniy wrote:
>
> I only just finally wrapped my head around this stuff and forgive me if I
> have missed the poi
I only just finally wrapped my head around this stuff and forgive me if I
have missed the point of the question but this is what my code has:
type AbstractType alias/struct {}
type abstractthing interface {
DoSomething(interface{})
}
func (a *AbstractType) DoSomething(b AbstractType) {
}
an
11 matches
Mail list logo