如何在这个容器中获取容器ip地址?
'docker inspect $ hostname ...'不合适,因为我没有将/var/run/docker.sock主机文件共享到容器中.
我的XML数据:
<dictionary version="0.8" revision="403605">
<grammemes>
<grammeme parent="">POST</grammeme>
<grammeme parent="POST">NOUN</grammeme>
</grammemes>
</dictionary>
Run Code Online (Sandbox Code Playgroud)
我的代码:
type Dictionary struct {
XMLName xml.Name `xml:"dictionary"`
Grammemes *Grammemes `xml:"grammemes"`
}
type Grammemes struct {
Grammemes []*Grammeme `xml:"grammeme"`
}
type Grammeme struct {
Name string `xml:"grammeme"`
Parent string `xml:"parent,attr"`
}
Run Code Online (Sandbox Code Playgroud)
我得到Grammeme.Parent属性,但我没有得到Grammeme.Name.为什么?
我正在尝试在松露框架中测试智能合约的应付方法:
contract Contract {
mapping (address => uint) public balances;
function myBalance() public view returns(uint) {
return balances[msg.sender];
}
function deposit() external payable {
balances[msg.sender] += msg.value;
}
}
contract TestContract {
function testDeposit() external payable {
Contract c = new Contract();
c.deposit.value(1);
Assert.equal(c.myBalance(), 1, "#myBalance() should returns 1");
}
}
Run Code Online (Sandbox Code Playgroud)
我运行后truffle test
,它失败并TestEvent(result: <indexed>, message: #myBalance() should returns 1 (Tested: 0, Against: 1))
出现错误。为什么?